对于josn类型里面的response返回的字典里面的.mp4链接怎么提取。
{"resultCode":"1",
"resultMsg":"success", "reqId":"9ee29958-a1d9-4a36-a16d-11e9c8f45342",
"systemTime": "1603612097370",
"videoInfo":{"playSta":"1","video_image":"https://image.pearvideo.com/cont/20201023/10008579-151234-1.png","videos":{"hdUrl":"","hdflvUrl":"","sdUrl":"","sdflvUrl":"","srcUrl":"https://video.pearvideo.com/mp4/third/20201023/1603612097370-10008579-151057-hd.mp4"}}
}
这个是json类型的response字典。我想从里面提取出https://video.pearvideo.com/mp4/third/20201023/1603612097370-10008579-151057-hd.mp4这一条链接然后持久化存储。 response = requests.get(self.url, params=...).json
mp4_url = response["videoInfo"]["videos"]["srcUrl"]
mp4_url可以下载blob持久化 也可以直接持久化这个链接 kogawananari 发表于 2020-10-25 16:27
response = requests.get(self.url, params=...).json
mp4_url = response["videoInfo"]["videos"]["srcUr ...
{'resultCode': '5', 'resultMsg': '该文章已经下线!', 'systemTime': '1603614683500'}
{'resultCode': '5', 'resultMsg': '该文章已经下线!', 'systemTime': '1603614683674'}
{'resultCode': '5', 'resultMsg': '该文章已经下线!', 'systemTime': '1603614683864'}
{'resultCode': '5', 'resultMsg': '该文章已经下线!', 'systemTime': '1603614684163'}
爬取出来是这样是怎么回事?xd 先判断resultCode==1 孝白歌 发表于 2020-10-25 16:38
{'resultCode': '5', 'resultMsg': '该文章已经下线!', 'systemTime': '1603614683500'}
{'resultCode' ...
刚回答了一个,也是爬取梨视频的,需要在请求头里面加Referer,加了后就有数据了
页:
[1]