我通过继承RFPDupeFilter
创建一个自定义过滤器。
下面是我使用代码的链接:
https://github.com/j4s0nh4ck/wiki-spider/blob/master/wiki/wiki/SeenURLFilter.py
注意:我在一个名为custom的自定义文件中有上述代码_过滤器.py在同一目录中设置.py居住在设置.py我有这个密码。在
DUPEFILTER_CLASS = 'myspider.custom_filters.SeenURLFilter'
但是当我运行机器人时,我得到了一个错误:
exceptions.TypeError:
__init__()
takes exactly 1 argument (3 given)
正如您在回溯中看到的那样,} is used :
from_settings()
方法被调用-然后它会创建一个自定义dupe过滤器的实例。但是,由于您没有指定您自己的from_settings()
方法the one from built-in ^{它尝试使用
path
和debug
构造函数参数实例化自定义dupe筛选器。并且您的SeenURLFilter
构造函数不接受debug
参数。在您还需要让dupefilter接受^{} parameter :
^{pr2}$相关问题 更多 >
编程相关推荐