Press ESC to close

wordpress读取MCV_Video标签并写入到Excel文件中

代码:

from http import client
from wordpress_xmlrpc import Client, WordPressPost
from wordpress_xmlrpc.methods.posts import GetPosts
from wordpress_xmlrpc.methods import posts
from wordpress_xmlrpc import WordPressTerm
from wordpress_xmlrpc.methods import taxonomies
import json
import pandas as pd
import xlwt
import xlrd

wp = Client('https://www.xacisco.net/xmlrpc.php', 'xxx', 'xxx')

workbook = xlwt.Workbook(encoding='ascii')
worksheet = workbook.add_sheet("My new Sheet")

allposts = wp.call(GetPosts({'post_type': 'mcv_video', 'number': 2060}))
for i in range(0, len(allposts)):
mcv_video_code = '[mine_cloudvod id=' + allposts[i].id + ']'
print(allposts[i].id, allposts[i].title, mcv_video_code)
worksheet.write(i, 0, allposts[i].id)
worksheet.write(i, 1, allposts[i].title)
worksheet.write(i, 2, mcv_video_code)

workbook.save("网站的mcv_video标签.xls")

发表回复