python 爬取视频简单测试
Posted 睁yan-ii
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python 爬取视频简单测试相关的知识,希望对你有一定的参考价值。
import requests def download_file(url, path): with requests.get(url, stream=True) as r: chunk_size = 1024 content_size = int(r.headers[\'content-length\']) print(r,\'ks\') \'下载开始\' with open(path, "wb") as f: for chunk in r.iter_content(chunk_size=chunk_size): f.write(chunk) if __name__ == \'__main__\': url=\'https://vd3.bdstatic.com//mda-meuj6t9f3z2j7bse//cae_h264_clips//1622296906542144945//mda-meuj6t9f3z2j7bse.mp4?auth_key=1622692948-0-0-3f8373256cde17047e56ac87175eb1bc&bcevod_channel=searchbox_feed&pd=1&pt=3&abtest=\' path = \'./a.mp4\' download_file(url, path)
以上是关于python 爬取视频简单测试的主要内容,如果未能解决你的问题,请参考以下文章