import requests
import json
from urllib import parse
"""https://h5.weishi.qq.com/weishi/feed/71yYpleeM1HghTttk/wsfeed?_proxy=1&_wv=1&wxplay=1&id=71yYpleeM1HghTttk&spid=1555397841340472&reqseq=250827838&cover=http%3A%2F%2Fpic640.weishi.qq.com%2F2984899cb2ec445ab029fbdcbfc9cover.jpg&bgSize=cover&image=84899cb2ec445ab029fbdcbfc9cover.&xflag=2130706433a156250141b1555397849https://h5.weishi.qq.com/webapp/json/weishi/WSH5GetPlayPage?t=0.7532600494918984&g_tk=&feedid=71yYpleeM1HghTttk&recommendtype=0&datalvl=&qua=&uin=&format=json&inCharset=utf-8&outCharset=utf-8"""
url = 'https://h5.weishi.qq.com/weishi/feed/71yYpleeM1HghTttk/wsfeed?_proxy=1&_wv=1&wxplay=1&id=71yYpleeM1HghTttk&spid=1555397841340472&reqseq=250827838&cover=http%3A%2F%2Fpic640.weishi.qq.com%2F2984899cb2ec445ab029fbdcbfc9cover.jpg&bgSize=cover&image=84899cb2ec445ab029fbdcbfc9cover.&xflag=2130706433a156250141b1555397849'
result = parse.urlparse(url)
q_dict = parse.parse_qs(result.query)
# 视频ID
vid = q_dict['id'][0]
player_url = 'https://h5.weishi.qq.com/webapp/json/weishi/WSH5GetPlayPage?t=0.7532600494918984&g_tk=&feedid={}&recommendtype=0&datalvl=&qua=&uin=&format=json&inCharset=utf-8&outCharset=utf-8'.format(
vid)
# 获取返回的JSON信息
content = requests.get(player_url).text
r = json.loads(content)
# 视频信息
video_info = r['data']['feeds'][0]
# 标题
title = video_info['feed_desc']
# 视频地址
video = video_info['video_url']
# 封面
cover = video_info['material_thumburl']
print(title, cover, video)
2776

被折叠的 条评论
为什么被折叠?



