原理
F12点击graphql能够看到里面有若干视频信息,一会儿要取其中的url地址
右键复制cURL
然后进入到这个转换器连接
https://curlconverter.com/python/
点击这个连接复制上述信息,然后就能解析处下面的代码,拷贝到你的项目中替换cookies,headers,json_data
源代码
import os
import requests
cookies = {
'kpf': 'PC_WEB',
'clientid': '3',
'did': 'web_e45d805382b61f95d23f2dacc976e9c8',
'ktrace-context': '1|MS43NjQ1ODM2OTgyODY2OTgyLjYxNzI3ODUxLjE3MDA0NDk0ODk1MDguMzkwNjQ4|MS43NjQ1ODM2OTgyODY2OTgyLjEyODE3MjM2LjE3MDA0NDk0ODk1MDguMzkwNjQ5|0|graphql-server|webservice|false|NA',
'kpn': 'KUAISHOU_VISION',
}
headers = {
'Accept-Language': 'zh-CN,zh;q=0.9',
'Connection': 'keep-alive',
# 'Cookie': 'kpf=PC_WEB; clientid=3; did=web_e45d805382b61f95d23f2dacc976e9c8; ktrace-context=1|MS43NjQ1ODM2OTgyODY2OTgyLjYxNzI3ODUxLjE3MDA0NDk0ODk1MDguMzkwNjQ4|MS43NjQ1ODM2OTgyODY2OTgyLjEyODE3MjM2LjE3MDA0NDk0ODk1MDguMzkwNjQ5|0|graphql-server|webservice|false|NA; kpn=KUAISHOU_VISION'