Why does scrapy throw an error for me when trying to spider and parse a site?

前端 未结 2 1035
离开以前
离开以前 2020-12-16 05:53

The following code

class SiteSpider(BaseSpider):
    name = \"some_site.com\"
    allowed_domains = [\"some_site.com\"]
    start_urls = [
        \"some_sit         


        
相关标签:
2条回答
  • 2020-12-16 06:07

    By default scrapy searches for parse function in the class. Here in your spider, parse function is missing. Instead of parse you have given parse_item. The problem will be solved if parse_item is replace with parse. Or you can override the parse method in spider.py with that of parse_item.

    0 讨论(0)
  • 2020-12-16 06:10

    I needed to change BaseSpider to CrawlSpider. Thanks srapy users!

    http://groups.google.com/group/scrapy-users/browse_thread/thread/4adaba51f7bcd0af#

    Hi Bob,

    Perhaps it might work if you change from BaseSpider to CrawlSpider? The BaseSpider seems not implement Rule, see:

    http://doc.scrapy.org/topics/spiders.html?highlight=rule#scrapy.contr...

    -M

    0 讨论(0)
提交回复
热议问题