Python 使徒行者3
简单脚本py,供看电视剧用
from requests import post
from json import loads
from time import time
from re import search
headers = {'user-agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 '
'(KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36'}
def pourl(url, rg='1-99'):
data = {
'id': url.split('/')[-1][:-5], 'type': '4', 'range': rg, 'plname': 'qq', 'otype': 'json',
'callback': '_jsonp_3_2405', '_t': str(int(round(time() * 1000)))
}
utxt = post(url='https://s.video.qq.com/get_playsource', headers=headers, data=data).text
rang = loads(utxt.split('(')[-1][:-1]).get('PlaylistItem').get('indexList')
return rang, utxt
def getul(url):
tli = []
for t in [pourl(url, y)[1] for y in pourl(url)[0]]:
tli.extend(['[{nums} {tags}](https://h8jx.bjtjr.net/h8jx.php?url={urls})\n'.format(
urls=d.get('playUrl'), tags=(d.get('markLabelList')[0].get('primeText') if d.get('markLabelList') else ''),
nums=d.get('title')) for d in loads(t.split('(')[-1][:-1]).get('PlaylistItem').get('videoPlayList')
if not search('预告', (d.get('markLabelList')[0].get('primeText') if d.get('markLabelList') else ''))])
print(''.join(tli))
if __name__ == '__main__':
getul('https://v.qq.com/detail/m/mzc00200x0no5q6.html')
不断学习