Skip to content

export csdn blog articles to markdown or html.translate the blog to hexo style 导出CSDN博客文章为markdown或html,转换博客为hexo博客格式

Notifications You must be signed in to change notification settings

Jordanzheng/csdn-blog-export

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 

Repository files navigation

CSDN 博客导出工具

一个用python2.7写的博客导出工具,导出为markdown或者html。

新增特性

1、修复获取博客页数的bug、去除正文中博文标题

2、新增脚本md2hexo.py将从csdn导出的博客润色满足hexo格式的博客,主要是在.md格式文件头添加一段文件描述,同时将文件名改为博文名。

使用

依赖

Python 2.7
	beautifulsoup4

此外,在导出markdown格式的时候使用了开源项目html2text

使用方法

1、从csdn导出博客 (注意:博客主题需切回旧的主题“编程工作室”,我的“大白”主题失效)  

main.py -u <username> [-f <format>] [-p <page>] [-o <outputDirectory>]
	<format>: html | markdown,缺省为markdown
	<page>为导出特定页面的文章,缺省导出所有文章
	<outputDirectory>暂不可用 

2、导出文件转换为hexo格式

1、分别在两个文件下从csdn导出md和html格式的文件
2、执行md2hexo.py脚本从.html文件中提取出博文标题和博文创建时间,将它们插入.md文件  

效果如下面所示:

title: Hello World
date: 2014-05-27 10:04:08
tag: 博客
category: 博客建设
---

Example

如果想导出http://blog.csdn.net/cecesjtu的文章,格式为markdown,命令为:

./main.py -u cecesjtu -f markdown
or
./main.py -u cecesjtu

格式为html,命令为:

./main.py -u cecesjtu -f html

To Do

  1. 导出到指定目录

Licence

GPLv3

About

export csdn blog articles to markdown or html.translate the blog to hexo style 导出CSDN博客文章为markdown或html,转换博客为hexo博客格式

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages

  • Python 100.0%