asdTools-爬取WordPress文章并获得Markdown文本

Github - 开源代码及Readme
Blog - 工具介绍

摘要:爬取我的WordPress博客,并以markdown格式输出。

场景

  • 想快速以带水印的markdown格式转发我的博客,不想手动敲。

使用示例

from asdTools.Classes.Spider.WordPressSpiderInMarkdown import WordPressSpiderInMarkdown
from asdTools.Classes.Tool.Clipboard import Clipboard

if __name__ == "__main__":
    """
    Before: https://mwhls.top/4810.html
    After: https://blog.csdn.net/asd123pwj/article/details/132394313
    仅在我的博客测试正常:mwhls.top
    爬取WordPress文章,并转为markdown格式
    Only testing in my blog: mwhls.top
    Crawl post of WordPress, and output in markdown
    """
    spider = WordPressSpiderInMarkdown()
    spider.log("Input post url from mwhls.top:") 
    url = spider.input("")

    spider.log(f"Parsing {url}")
    title, result = spider.get_post(url)

    spider.log("Title has copied")
    Clipboard.copy(title)
    spider.pause()

    spider.log("Content has copied")
    Clipboard.copy(result)
    spider.done()
    spider.pause()

版权声明:
作者:MWHLS
链接:https://mwhls.top/4824.html
来源:无镣之涯
文章版权归作者所有,未经允许请勿转载。

THE END
分享
二维码
打赏
< <上一篇
下一篇>>
文章目录
关闭
目 录