作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我一直在尽力使用 Beautifulsoup4 获取驱动程序的所有 dl。但是它返回我不需要的链接。我认为它们以某种方式隐藏起来,我一生都无法将它们取出。
here是我试图废弃的页面: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']
关于Python戴尔驱动程序下载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48237272/
有人能在 adb devices 命令中看到 Dell Streak 吗?我在哪里可以获得 USB 驱动程序?到目前为止,这是我唯一无法用于开发的设备...5 小时后我完全累了:( 感谢您的帮助。 稍
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 我们不允许在 Stack Overflow 上提出有关通用计算硬件和软件的问题。您可以编辑问题,使其成为
我是一名优秀的程序员,十分优秀!