我正试图从linked in的搜索页面获取公司的行业信息。我得到Chrome开发工具的xpath格式,但它返回空括号。这里的问题是什么?在
from lxml import html
import requests
page = requests.get('https://www.linkedin.com/search/results/companies/?keywords=cisco.com')
tree = html.fromstring(page.content)
industry = tree.xpath('//*[@id="ember3734"]/div/div[1]/p[1]')
print(industry)
我用selenium和phantomjs编写了脚本,因为网站使用了大量javascript。在
我认为这个页面是由JavaScript生成的。由于请求下载页面而不执行JavaScript,因此只能得到主页/模板,而不能获得预期的数据。在
请尝试Chrome下的“查看源页面”进行确认。在
相关问题 更多 >
编程相关推荐