blog2md icon indicating copy to clipboard operation
blog2md copied to clipboard

博客文章转成 Markdown 格式

blog2md

Translate your blog articles to markdown files! (Support Hexo now)

How to use

import blog2md

my_blog = blog2md.Blog(
    "http://blog.csdn.net/synapse7/article/list/",
    entry_tag='span',
    entry_class='link_title',
)
for article in my_blog.get_all_articles():
    article.to_hexo(
        content_class='article_content',
        time_class='link_postdate',
        tag_class='tag2box',
    )

Result:

See test.py for more details.

Notice

There is a BUG in html2text/config.py:

# Wrap long lines at position. 0 for no wrapping. (Requires Python 2.3.)
BODY_WIDTH = 78

Change 78 to 0 to disable wrapping before you run.

License

MIT