una199303 2020-09-02 14:54 采纳率: 0%
浏览 234

RedisSpider爬虫报错 2020-09-02 14:44:36 [twisted] CRITICAL: Unhandled error in Deferred:

# -*- coding: utf-8 -*-
import scrapy,re
from bs4 import BeautifulSoup
from scrapy_redis.spiders import RedisSpider
from urllib import parse

class TtttSpider(RedisSpider):
    name = 'tttt'
    allowed_domains = ['chinanews.com']
    redis_key = "tttt"

    def parse(self, response):
        html = response.text
        soup = BeautifulSoup(html, 'html.parser')
        data = soup.find_all('a')
        for item in data:
            index = {}
            if item.string is not None and item['href'] != 'javascript:;' and item.get('href') and item['href'] != '#':
                url = parse.urljoin(response.url, item.get('href'))
                index[url] = item.string
                print("index", index)
                print(url)
                yield scrapy.Request(url, callback=self.next_parse, meta={"item": index})

    def next_parse(self, response):
        print("11111111")


不是立即报错,调用了parse函数,就不在往下执行了。报错

  • 写回答

1条回答 默认 最新

  • threenewbee 2020-09-02 15:19
    关注

    这一般是原生dll内存泄露或者调用错误。
    https://blog.csdn.net/z564359805/article/details/80803730

    评论

报告相同问题?

悬赏问题

  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥15 stable diffusion
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿