scrapy:NotImplementedError未定义解析回调

vyu0f0g1  于 2022-11-09  发布在  其他
关注(0)|答案(1)|浏览(147)

我已经开始写一个scrapy spider,当我在VS代码中运行spider时,我一直得到这个错误。

Traceback (most recent call last):
      File "/usr/lib/python3/dist-packages/twisted/internet/defer.py", line 654, in _runCallbacks
        current.result = callback(current.result, *args,**kw)
      File "/usr/lib/python3/dist-packages/scrapy/spiders/__init__.py", line 90, in parse
        raise NotImplementedError('{}.parse callback is not defined'.format(self.__class__.__name__))
    NotImplementedError: PukeSpider.parse callback is not
 defined

这是密码

import scrapy

class ScatSpider(scrapy.Spider):
    name = 'videos'
    start_urls = [

        'https://thisvid.com/tags/scat/',
    ]

def parse(self, response):
    for videos in response.css('a.tumbpu'):
        yield {
            'title': response.css('span.title::text').get(),
            'link': response.css('a.tumbpu::text').attrib['href']
        }
ltskdhd1

ltskdhd11#

"萨米尔·达斯"

def login(self, response):
        csrf_token = response.css('[name="csrf_token"]::attr(value)').get()
        form_data = {
        'csrf_token': csrf_token,
        'username': 'samircd4',
        'password': '123456'
        }
        return FormRequest.from_response(response, formdata=form_data,callback=self.strat_scraping)

def strat_scraping(self, response):
    pass

相关问题