python 爬取视频简单测试
2021/6/3 12:20:54
本文主要是介绍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 爬取视频简单测试的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-11-25Python编程基础:变量与类型
- 2024-11-25Python编程基础与实践
- 2024-11-24Python编程基础详解
- 2024-11-21Python编程基础教程
- 2024-11-20Python编程基础与实践
- 2024-11-20Python编程基础与高级应用
- 2024-11-19Python 基础编程教程
- 2024-11-19Python基础入门教程
- 2024-11-17在FastAPI项目中添加一个生产级别的数据库——本地环境搭建指南
- 2024-11-16`PyMuPDF4LLM`:提取PDF数据的神器