赞
踩
获取网站视频 url = 'https://edu.xxxx.com/' res = requests.get(url) content = res.content soup = BeautifulSoup(content, 'html.parser') mp4_src_url = soup.find("video", class_="ub-binner-video-box")["src"] with open("D:/qhy-work/moive_resouce/ibtdy20231117/video/haisi.mp4", 'wb')as f: f.write(requests.get(mp4_src_url).content) f.close()
语法:
soup=BeautifulSoup(content,"html.parser")
soup.find('标签名',属性="属性值") #获取一个列表
soup.text #取出值,可根据切片,取值
例如:html
soup.select 方法
soup=BeautifulSoup(content,"html.parser")
content=soup.select(‘div.hl-item-title.hl-text-site.hl-lc-1‘)
content.getText() 取出文本
赞
踩
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。