Python戴尔驱动下载
Python Dell driver download
我一直在尽力为使用 Beautifulsoup4 的驱动程序获取所有 dl。但是它 returns 我不需要的链接。我认为它们以某种方式被隐藏起来,我这辈子都无法将它们取出来。
here is the page I'm attempting to scrap: 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']
驱动链接是js加载的,所以通常需要使用selenium
或者类似的客户端。但是在这种情况下,所有驱动程序信息都以 json 格式提供,在 'text/preloaded' 脚本标记中。
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']
我一直在尽力为使用 Beautifulsoup4 的驱动程序获取所有 dl。但是它 returns 我不需要的链接。我认为它们以某种方式被隐藏起来,我这辈子都无法将它们取出来。
here is the page I'm attempting to scrap: 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']
驱动链接是js加载的,所以通常需要使用selenium
或者类似的客户端。但是在这种情况下,所有驱动程序信息都以 json 格式提供,在 'text/preloaded' 脚本标记中。
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']