python小视频_Python 下载腾讯微视小视频(无水印)

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)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值