使用模块PyTypecho
使用此模块在配合requests,BeautifulSoup就可以写出自动采集发布脚本了

from pytypecho import Typecho,Attachment,Post pageContent = { } pageContent["title"] = '标题' pageContent["content"] = '内容' wp = Typecho("https://www.529i.com/action/xmlrpc", "帐号", "密码") post = Post(title=pageContent["title"],description=pageContent["content"]) post.title = pageContent["title"] post.content = pageContent["content"] post.categories = ['采集'] #分类 post.terms_names = { 'category': ['采集'] # 文章所属分类,没有则自动创建 } #print(post) wp.new_post(post,publish=True)
如果觉得我的文章对你有用,请随意赞赏