Scrapy不会爬行

问题描述 投票:-1回答:1

[When I am running it in terminal the output isenter image description hereScrapy Crawler在我在终端中运行代码时正在爬行,但是当我在编辑器中运行相同代码时却无法工作。我的代码是:

from scrapy import Spider
from selenium import webdriver
from scrapy.selector import Selector
from scrapy.http import Request
class BooksSpider(Spider):
    name = 'books'
    allowed_domains = ['books.toscrape.com']


def start_request(self, response):
    self.driver=webdriver.Chrome(r'C:\Users\Night-Watch\Desktop\chromedriver.exe')
    self.driver.get('http://books.toscrape.com')
    sel=Selector(text=self.driver.page_source)


    books=sel.xpath('//h3/a/@href').extract()
    print(books)
python selenium scrapy
1个回答
0
投票
  1. 您确定要使用Selenium抓取简单的测试站点吗?这是相当大的开销。
  2. 您能否提供错误文本和堆栈跟踪信息以了解情况的全貌。
© www.soinside.com 2019 - 2024. All rights reserved.