Conversation
- A modern spider design that uses AnyIO and asyncio, yet it's very similar to Scrapy spiders API because it's the easiest design for users, and to make it easier for new users. - Spiders can have multiple sessions per crawl, and users decide which session to use with each request. - A scheduler system that uses heapq logic. - The user can set the number of concurrent requests for a spider globally or per domain. - The user can set a download delay to control the speed of the spider more. - There's a global function that can be overridden to handle errors for all requests. (Similar to errback in scrapy). - There's a spider argument to set the allowed domains for the spider to stay in. - Each spider has a very detailed crawl stats that can be accessed right away from the code after the crawl finishes. Same case with scraped items. - The whole spider as written as any other script and you just run it. No command-line arguments, and no need to run it from the terminal through the library like other known alternatives. - Each spider has its own logger that forces sessions to use it. - Each spider has functions to override that run before start and after close. - There's a spider argument to set the logging level and another one to make the spider write to a log file. - This is only the start. A lot more features are coming in the way.
This was causing the browser and the whole code to stand still.
It makes root's value None
…d a stat for this
…nference
Type checkers now correctly infer the return type based on the default value:
- .get() → TextHandler | None
- .get("") → TextHandler | str
- .get(0) → TextHandler | int
It can be considered the simplest form of round robin since we don't have weights or anything (as was originally planned), but let's change it to avoid confusion or useless debates. Here goes nothing
Automated. I don't know how I missed all of that!
Automated tests written by AI
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The biggest release of Scrapling yet — introducing the Spider framework, proxy rotation, and major parser improvements
This release brings a fully async spider/crawling framework, intelligent proxy management, and significant API changes that make Scrapling more powerful and consistent. Please review the breaking changes section carefully before upgrading.
🕷️ Spider Framework
A new async crawling framework built on top of
anyiofor structured, large-scale scraping:start_urls, asyncparsecallbacks,Request/Responseobjects, and priority queue.async for item in spider.stream()with real-time stats - ideal for UI, pipelines, and long-running crawls.result.items.to_json()/result.items.to_jsonl()respectively.on_start(),on_close(),on_error(),on_scraped_item(), and more hooks for full control over the crawl lifecycle.use_uvloop=Truetospider.start()for faster async execution when available.A new section has been added to the website with the Full details. Click here
🔄 Proxy Rotation
ProxyRotatorclass with thread-safe rotation. Works with all fetchers and sessions:proxy=to any individualget()/post()/fetch()call to override the session proxy for that request.🌐 Browser Fetcher Improvements
blocked_domainsparameter onDynamicFetcher/StealthyFetcherto block requests to specific domains (subdomains matched automatically).retries(default: 3) andretry_delay(default: 1s) parameters. Includes proxy-aware error detection.Response.metadict automatically stores the proxy used, and merges request metadata.Requestobjects with automatic referer flow, designed for the spider system.🔧 Bug Fixes & Improvements
css_first/xpath_firstremoved: Usecss('.selector').first,css('.selector')[0], orcss('.selector').get()instead.Selectors:css('::text'),xpath('//text()'),css('::attr(href)'), andxpath('//@href')now returnSelectors(wrapping text nodes inSelectorobjects withtag="#text") instead ofTextHandlers. This makes the API consistent across all selection methods and the type hints.Response.bodyis alwaysbytes: Previously could bestrorbytes, now always returnsbytes.get()/getall()behavior: OnSelector:get()returnsTextHandler(serialized HTML or text value),getall()returnsTextHandlers. Aliases:extract_first = get,extract = getall. Oldget_all()onSelectorsis removed.Selectors.first/.last: Safe accessors that returnSelector | Noneinstead of raisingIndexError.DEFAULT_FLAGS→DEFAULT_ARGS,DEFAULT_STEALTH_FLAGS→STEALTH_ARGS,HARMFUL_DEFAULT_ARGS→HARMFUL_ARGS,DEFAULT_DISABLED_RESOURCES→EXTRA_RESOURCES.🔨 Other Changes
tldextractwithtld, removed internal_html_utils.pyin favor ofw3lib.html.replace_entities, addedtyping_extensionsas a hard requirement.🙏 Special thanks to our Discord community for all the continuous testing and feedback
Big shoutout to our biggest Sponsors