GithubHelp home page GithubHelp logo

jordanzheng / csdn-blog-export Goto Github PK

View Code? Open in Web Editor NEW

This project forked from gaocegege/csdn-blog-export

0.0 1.0 1.0 29 KB

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

Python 100.00%

csdn-blog-export's Introduction

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

csdn-blog-export's People

Contributors

gaocegege avatar jordanzheng avatar

Watchers

 avatar

Forkers

huangankun

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.