使用python编程从网站下载视频
我想用python编程下载下面URL上的视频。有人能帮忙吗使用python编程从网站下载视频,python,web-scraping,Python,Web Scraping,我想用python编程下载下面URL上的视频。有人能帮忙吗 谢谢下面的代码将下载您想要的文件,但它不是您想要的 import requests response = requests.get("https://projector.datacamp.com/?auto_play=play&projector_key=course_1939_153fd7068f48d10ef4d962216ccbe12b", allow_redirects=True) with o
谢谢下面的代码将下载您想要的文件,但它不是您想要的
import requests
response = requests.get("https://projector.datacamp.com/?auto_play=play&projector_key=course_1939_153fd7068f48d10ef4d962216ccbe12b", allow_redirects=True)
with open("video.html", "wb") as outfile:
outfile.write(response.content)
这不会下载网站正在播放的视频
你要做的是找到HTML中列出的.mp4文件,你可以使用你想要的任何方法,scrapy或beautifulsoup或其他任何方法。下面的代码与实际下载的文件
import requests
response = requests.get("https://videos.datacamp.com/raw/1939_supervised_learning_w_scikit_learn/v9/1939_ch3_3.mp4", allow_redirects=True)
with open("video2.html", "wb") as outfile:
outfile.write(response.content)
你已经试过什么了?展示一些代码。你必须展示你的代码以及你的错误。无论如何,我会回答你的问题,要完成它,首先,从页面上抓取视频URL,然后使用请求或URL库。。。下载。