[英]Python Dell driver download
I have been trying my best to get all the dl for drivers using Beautifulsoup4. 我一直在竭尽全力为使用Beautifulsoup4的驱动程序获取所有dl。 however it returns links I don't need.
但是它返回我不需要的链接。 I think they are somehow hidden and for the life of me I can not get them out.
我认为它们某种程度上是隐藏的,对于我的一生,我无法摆脱它们。
here is the page I'm attempting to scrap: http://www.dell.com/support/home/us/en/19/product-support/servicetag/1h1c5p1/drivers 这是我要剪贴的页面: http : //www.dell.com/support/home/us/en/19/product-support/servicetag/1h1c5p1/drivers
from bs4 import BeautifulSoup
import urllib2
resp = urllib2.urlopen("http://www.gpsbasecamp.com/national-parks")
soup = BeautifulSoup(resp, from_encoding=resp.info().getparam('charset'))
for link in soup.find_all('a', href=True):
print link['href']
The driver links are loaded by js, so usually you'd have to use selenium
or similar clients. 驱动程序链接由js加载,因此通常您必须使用
selenium
或类似的客户端。 However in this case, all the driver info is available in json format, in a 'text/preloaded' script tag. 但是,在这种情况下,所有驱动程序信息均以json格式提供,位于“文本/预加载”脚本标签中。
from bs4 import BeautifulSoup
import urllib2
import json
resp = urllib2.urlopen("http://www.dell.com/support/home/us/en/19/product-support/servicetag/1h1c5p1/drivers")
soup = BeautifulSoup(resp, 'html.parser', from_encoding=resp.info().getparam('charset'))
data = json.loads(soup.find('script', type='text/preloaded').text)
for item in data:
print 'Name', item['driverName']
print 'Link', item['fileFrmtInfo']['httpFileLocation']
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.