spider_3_quotes_selenium.py 文件源码

python
阅读 17 收藏 0 点赞 0 评论 0

项目:scrapy-training 作者: scrapinghub 项目源码 文件源码
def parse(self, response):
        self.driver.get(response.url)
        sel = scrapy.Selector(text=self.driver.page_source)
        for quote in sel.css('div.quote'):
            yield {
                'text': quote.css('span.text::text').extract_first(),
                'author': quote.css('span small::text').extract_first(),
                'tags': quote.css('div.tags a.tag::text').extract(),
            }
        next_page = sel.css('li.next > a::attr(href)').extract_first()
        if next_page:
            yield scrapy.Request(response.urljoin(next_page))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号