Skip to main content

Extensible async scraper library for concurrent web scraping with worker pattern

Project description

FastScrapy

Lightweight async web scraper framework for concurrent scraping.

Why fastscrapy?

  1. Worker inheritance: Override worker() to define your scraping logic
  2. Pure async: Built on asyncio and aiohttp. No callbacks, no frameworks
  3. Minimal: ~50 lines of code. Learn it in 5 minutes

Quick Start

from fastscrapy import FastScraper

class MyScraper(FastScraper):

	def __init__(self, num_pages: int):
		self.remaining_pages = set(range(num_pages))
		self.url = 'https://jsonplaceholder.typicode.com/posts'

	# override this function
	async def worker(self, worker_id: int):
		while self.remaining_pages:
			page = self.remaining_pages.pop()

			response = await self.request(self.url, params={
				'_page': page,
				'_limit': 10
			})

			posts = await response.json()
			print(f"Worker {worker_id}: page {page} has {len(posts)} posts")


scraper = MyScraper(100)

# invoke 5 worker functions asynchronously
scraper.run(num_workers=5)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fastscrapy-0.1.0.tar.gz (14.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fastscrapy-0.1.0-py3-none-any.whl (14.8 kB view details)

Uploaded Python 3

File details

Details for the file fastscrapy-0.1.0.tar.gz.

File metadata

  • Download URL: fastscrapy-0.1.0.tar.gz
  • Upload date:
  • Size: 14.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for fastscrapy-0.1.0.tar.gz
Algorithm Hash digest
SHA256 978398a5c5fd9b6219b6b8e85728bdce9ba7d8e6e5929c1c3b955989915ed182
MD5 2ec6c86a310635581e69e62a934f8ceb
BLAKE2b-256 a41a168e4b9ae3c4efbe1d3637a8e0308a995b1ee7e16603562f25257ff0fc2f

See more details on using hashes here.

File details

Details for the file fastscrapy-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: fastscrapy-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 14.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for fastscrapy-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 302210df1e6b7fa7a37a3c055fca0d400ab6beca067ff034496fbf08ea9c359f
MD5 5314ba7902c88a87a7791c143d7b985e
BLAKE2b-256 f54670f9a4b6fc2c19ccfa4f07ab010b059167f289d9d98a499520c3856ccff9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page