Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8898569
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T00:38:41+00:00 2026-06-15T00:38:41+00:00

I am writing a crawler for a website using scrapy with CrawlSpider. Scrapy provides

  • 0

I am writing a crawler for a website using scrapy with CrawlSpider.

Scrapy provides an in-built duplicate-request filter which filters duplicate requests based on urls. Also, I can filter requests using rules member of CrawlSpider.

What I want to do is to filter requests like:

http:://www.abc.com/p/xyz.html?id=1234&refer=5678

If I have already visited

http:://www.abc.com/p/xyz.html?id=1234&refer=4567

NOTE: refer is a parameter that doesn’t affect the response I get, so I don’t care if the value of that parameter changes.

Now, if I have a set which accumulates all ids I could ignore it in my callback function parse_item (that’s my callback function) to achieve this functionality.

But that would mean I am still at least fetching that page, when I don’t need to.

So what is the way in which I can tell scrapy that it shouldn’t send a particular request based on the url?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T00:38:43+00:00Added an answer on June 15, 2026 at 12:38 am

    You can write custom middleware for duplicate removal and add it in settings

    import os
    
    from scrapy.dupefilter import RFPDupeFilter
    
    class CustomFilter(RFPDupeFilter):
    """A dupe filter that considers specific ids in the url"""
    
        def __getid(self, url):
            mm = url.split("&refer")[0] #or something like that
            return mm
    
        def request_seen(self, request):
            fp = self.__getid(request.url)
            if fp in self.fingerprints:
                return True
            self.fingerprints.add(fp)
            if self.file:
                self.file.write(fp + os.linesep)
    

    Then you need to set the correct DUPFILTER_CLASS in settings.py

    DUPEFILTER_CLASS = 'scraper.duplicate_filter.CustomFilter'
    

    It should work after that

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently writing a web crawler (using the python framework scrapy ). Recently I
I am writing a web crawler for reddit which only allows 1 request every
I am writing a crawler in Perl, which has to extract contents of web
I am writing a crawler. Once after the crawler logs into a website I
I'm writing a crawler with wombat . And somehow i'm using CSS selectors, not
I'm writing a web crawler and want to ignore URLs which link to binary
I'm writing a crawler to download the static html pages using urllib . The
So I am writing a simple website crawler for maintenance of in house sites.
I'm planning on writing a web crawler and a web-based front end for it
I'm writing a simple crawler in Python using the threading and Queue modules. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.