Web crawler 如何将LinkExtractor与SplashRequest一起使用?
如何执行LinkExtractor使用SplashRequest发送请求。Web crawler 如何将LinkExtractor与SplashRequest一起使用?,web-crawler,scrapy-splash,Web Crawler,Scrapy Splash,如何执行LinkExtractor使用SplashRequest发送请求。 我运行此代码,但只向主页发送请求,主页的链接不会被提取。 代码: 编辑 有什么评论吗?我认为你的问题太宽泛了:这个问题可能不涉及LinkedExtractor和ScrapySplash,也许试着消除其中一个并重新提问这个问题这是否回答了你的问题? rules = { Rule( LinkExtractor( restrict_xpaths=('//ul[contains(@cla
我运行此代码,但只向主页发送请求,主页的链接不会被提取。
代码: 编辑
有什么评论吗?我认为你的问题太宽泛了:这个问题可能不涉及LinkedExtractor和ScrapySplash,也许试着消除其中一个并重新提问这个问题这是否回答了你的问题?
rules = { Rule(
LinkExtractor(
restrict_xpaths=('//ul[contains(@class, "nav-list")]'),
),
callback="parse_item",
process_request='use_splash'
)
}
def use_splash(self, request):
return SplashRequest(url=request.url,
endpoint="render.json",
args={
"wait":1,
"har": 1,
"html": 1,
})
def start_requests(self):
yield SplashRequest("http://www.example.com",
callback=self.parse_item,
endpoint="render.json",
args={
"wait":1,
"har": 1,
"html": 1,
})
def parse_item(self):
# Extract item