python - Scrapy 中 requests.seen 文件中存储的值是什么?

标签 python django web-crawler scrapy

我的 requests.seen 文件中的一些示例值是

f4e2f84g6g987t69896gg83552ccb8c36bdff296

ccb8c36bdff29651d3080c9644b117364de75cd7

9ec11d5f1a4cda70af990ad40843615a5f1a4cda

我知道它们代表了我所抓取的 URL。如何将这些值转换为 URLS?或者更好的是,我如何将 URL 转换为等效的表示形式并检查它是否存在于 requests.seen 文件中?

最佳答案

见请求指纹功能 https://github.com/scrapy/scrapy/blob/master/scrapy/utils/request.py

The request fingerprint is a hash that uniquely identifies the resource the request points to

使用示例 redis dupefilter :

def request_seen(self, request):
    fp = request_fingerprint(request)
    added = self.server.sadd(self.key, fp)
    return not added

关于python - Scrapy 中 requests.seen 文件中存储的值是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20414711/

相关文章:

python - 根据构造函数签名使用不同的类定义

python - 网络爬虫 - 忽略 Robots.txt 文件?

node.js - 如何使用爬虫抓取网站的所有内部网址?

python - 将 &#39 变为普通字符

python - 在程序运行开始时填充 wxChoice | Python

django - 错误 : Target WSGI script not found or unable to stat when run django on apache

python - Django 正则表达式不匹配

python - 尝试基于嵌套模型外键过滤 django View 序列化器

java - 运行 Nutch 2 时出现连接拒绝错误

python - 如何在 python 中从 orderedDict 中删除条目