2024-09-29 01:18:55 发布
网友
不久前我偶然发现了pyexecjs,我想知道它是否可以与scrapy一起使用来抓取JS生成的数据。 https://github.com/doloopwhile/PyExecJS
我检查了库应该如何使用的示例,但我不确定如何将它与scrapy集成。在
我强烈建议你试试硒与幻影。下面是一个示例代码。在
from selenium import webdriver url = "http://www.taobao.com/" browser = webdriver.PhantomJS() browser.get(url) input = browser.find_element_by_xpath("//input[@id='q']") bnt = browser.find_element_by_xpath("//button[@class='btn-search']") input.send_keys("watch") bnt.submit()
有关API的详细信息,请参阅WebDriver API 至于如何将selenium与scrapy集成,我的建议是将其嵌入到you spider的parse函数中。例如:
我强烈建议你试试硒与幻影。下面是一个示例代码。在
有关API的详细信息,请参阅WebDriver API 至于如何将selenium与scrapy集成,我的建议是将其嵌入到you spider的parse函数中。例如:
相关问题 更多 >
编程相关推荐