Coder Social home page Coder Social logo

Comments (2)

ramsayleung avatar ramsayleung commented on May 30, 2024

因为爬虫的去重是scrapy-redis实现的,我并没有重写去重规则,而scrapy-redis 是根据 Requestfingerprint来作去重的判断依据的,所以可能相同的商品(即相同的url),但是Request对象不相同,就没有去掉.所以可能会出现重复的商品

from jd_spider.

ramsayleung avatar ramsayleung commented on May 30, 2024

其实最最开始的时候,也是有验证重复商品的,只是我是通过Mongodb 的唯一索引来去重的.插入是遇到重复的商品就抛出异常,然后把异常吃掉.这种去重方式很不优雅,现在我已经重写了商品的去重逻辑,通过Redis 保存商品的sku-id, 插入Mongodb 前验证一下Redis 是否已经有这个商品的sku-id, 有则不插入,反之亦然.

from jd_spider.

Related Issues (19)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.