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

文章首发见博客:https://mwhls.top/4824.html
无图/格式错误/后续更新请见首发页。
更多更新请到mwhls.top查看
欢迎留言提问或批评建议,私信不回。

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()
    

猜你喜欢

转载自blog.csdn.net/asd123pwj/article/details/132558759