import requests
from bs4 import BeautifulSoup
# 目标网页地址
url = 'https://www.pep.com.cn/rjyx/rjkj/202110/t20211015_1970988.shtml'
# 使用requests获取网页内容
response = requests.get(url)
web_content = response.text
# 使用BeautifulSoup解析网页
soup = BeautifulSoup(web_content, 'html.parser')
# 根据网页结构查找视频标签,这里以<video>标签为例
video_tags = soup.find_all('video')
# 遍历所有找到的视频标签
for video in video_tags:
# 视频的URL
video_url = video.get('src')
print('Found video URL:', video_url)
# 指定要保存视频的本地路径
local_filename = 'E:/360Downloads/python_download_video_example.mp4'
# 发送GET请求
response = requests.get(video_url, stream=True)
# 检查请求是否成功
if response.status_code == 200:
# 打

最低0.47元/天 解锁文章

864

被折叠的 条评论
为什么被折叠?



