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

本文介绍了一个Python脚本,用于爬取WordPress博客文章并将其转换为Markdown格式,方便快速转发。脚本开源,适用于个人博客测试,如mwhls.top。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

文章首发见博客: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.youkuaiyun.com/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()
    
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值