Skip to main content
https://travis-ci.org/scrapinghub/scrapy-mosquitera.svg?branch=master https://img.shields.io/pypi/v/scrapy-mosquitera.svg?maxAge=2592000 https://img.shields.io/pypi/pyversions/scrapy-mosquitera.svg?maxAge=2592000 https://img.shields.io/pypi/l/scrapy-mosquitera.svg?maxAge=2592000

How can I scrape items off a site from the last five days?

—Scrapy User

That question started the development of scrapy-mosquitera, a tool to help you restrict crawling and scraping scope using matchers.

Matchers are simple Python functions that return the validity of an element under certain restrictions.

The first goal in the project was date matching, but you can create your own matcher for your own crawling and scraping needs.

How it works

In the case where the dates are available in the URLs, you will just use the matcher function directly in your code:

from scrapy_mosquitera.matchers import date_matches

 date = scrape_date_from_url(url)

 if date_matches(data=date, after='5 days ago'):
    yield Request(url=url, callback=self.parse_item)

To handle the case when the date is only available at the time when you scrape the items, scrapy-mosquitera provides a PaginationMixin to control the crawl according to the dates scraped.

Head on to the remaining of the documentation for more details.

Installation

The quick way:

pip install scrapy-mosquitera

Metadata

Release files for scrapy-mosquitera 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for scrapy-mosquitera 0.1.1
File Size Uploaded
scrapy-mosquitera-0.1.1.tar.gz 18.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for scrapy-mosquitera 0.1.1
File Interpreter ABI Platform
scrapy_mosquitera-0.1.1-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 27.1 kB

Release files / scrapy-mosquitera-0.1.1.tar.gz

Download URL scrapy-mosquitera-0.1.1.tar.gz
Size 18.4 kB
Tags Source
SHA-256 checksum
How to use checksums
2ba3752240999a9111851b0cd0e4d31e3f073cbd241bd7afcc64db420d0b62b7
BLAKE2b-256 checksum
How to use checksums
0b6d4edc4532bc7181299cbee894b460d44b0b26d57ce09fce637077683735ad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / scrapy_mosquitera-0.1.1-py2.py3-none-any.whl

Download URL scrapy_mosquitera-0.1.1-py2.py3-none-any.whl
Size 8.7 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
92472f527dfb33efcc6733641de622c0537b71ee89a14111fb651c8f6c4d2a70
BLAKE2b-256 checksum
How to use checksums
b079d188e5de92c8699480fa464867982c50d0728408e54be275c14524a1aec3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page