Releases: D4Vinci/Scrapling
v0.2.96
This is an essential update for everyone to fully enjoy Scrapling as it's intended
What's changed
- Added the
-foption toscrapling installto force reinstall browser dependencies. I recommend you doscrapling install -fnow to enjoy the big speed performanceStealthyFetcherjust got with the new Camoufox browser version :) - Fixed a bug in
TextHandlerwhere slicing returnedTextHandlersinstead ofTextHandlerand fixed the type hint there (#41 ) - Fixed an issue where
scrapling installmight in some instances drop the user into a Python shell!
Thanks for all your support!
Big shoutout to our biggest Sponsor: Scrapeless
v0.2.95
This is an essential update for everyone to fully enjoy Scrapling as it's intended
What's changed
- Fixed a bug in
Fetcherthat made headers generated by thestealthy_headersargument overwrite some of the headers provided by the user likeAccept(#39 ) - Improved the headers generation logic a bit so it should give a slight speed boost.
Thanks for all your support!
Shoutout to our biggest Sponsor: Scrapeless
v0.2.94
This is an essential update for everyone to fully enjoy Scrapling as it's intended
What's changed
- Added the
historyproperty to all fetchers to show redirections (#32 ) - Fixed the logic of the
case_sensitiveargument logic for allre/re_first. This may make your code return different results if you were using it (but you probably deserve it because you noticed it wasn't working as intended and didn't open an issue LOL) - Updated dependencies and enabled
coopback again in the Camoufox engine (StealthyFetcher).
Thanks for all your support!
Shoutout to our biggest Sponsor: Scrapeless
v0.2.93
This is an essential update for everyone to fully enjoy Scrapling as it's intended
What's changed
- The return type is now consistent across all the parser engine so you will always get a return type as one of these
Adaptor,Adaptors,TextHandler,TextHandlers,None, and a list in case you have mixed results like combined CSS selector. This allows a better coding experience with minimum manual type checking, makes the library more stable, and makes chaining methods always possible. - Most of the parser engine especially the
Adaptorclass got refactored to a cleaner version and most importantly a faster version. So now almost all the methods/properties, especially the searching methods, got a speed increase between 5-40%. Some methods got bigger speed boosts likefind_by_regexgot a ~60% speed boost! The automatch feature got a small ~5% speed boost. - Fixed logic bugs with the
find_all/findmethods that made the passed filters used in OR fashion and other times as an AND. So now all elements returned need to fulfill all filters you pass. - Now all regex-related methods return
TextHandler/TextHandlersfor easier methods chaining. - Added a new
below_elementsproperty that returns anAdaptorsobject of all elements under the current element in the DOM tree. - Now all methods/properties that were returning HTML source as string are now returning it as
TextHandlerso you can do regex easily on it etc... - StealthyFetcher is now a bit faster and more stealthy. Also, now it's possible to click Captchas in iframes like Cloudflare Turnstile.
- The auto-completion and type hints improved a lot in nearly half the library. Especially
Adaptor,TextHandler, andTextHandlers. - Now slicing
TextHandler, accessing by index, or using thesplitmethod returns anotherTextHandlerinstead of the standard Python string. Now almost all standard string operations/methods return otherTexthandlerinstead of standard string to make chaining methods/functions always possible. - Fixed some small bugs and typos. For example, the Fetcher async_put was doing post request instead of put request 😶🌫️
- Improved the README a bit till I finish the documentation website.
This was supposed to be a small update till version 0.3 but thought to make it better.
Thanks for all your support!
Shoutout to our biggest Sponsor: Scrapeless
v0.2.92
What's changed
- Now response returned by browser-based fetchers uses more reliable data sources in cases where the page loaded uses many Iframes.
- Now installing
Scraplingis made even easier, you install it with pip then runscrapling installin the terminal and you are ready! - Fixed an inaccurate type hint in the parser.
Note
A friendly reminder that maintaining and improving Scrapling takes a lot of time and effort which I have been happily doing for months even though it's becoming harder. So, if you like Scrapling and want it to keep improving, you can help by supporting me through the Sponsor button.
v0.2.91
What's changed
- Fixed a bug where the logging fetch logging sentence was showing in the first request only.
- The default behavior for Playwright API while browsing a page is returning the first response that fulfills the load state given to the
gotomethod["load", "domcontentloaded", "networkidle"]so if a website has a wait page like Cloudflare's one that redirects you to the real website afterward, Playwright will return the first status code which in this case would be something like 403. This update solves this issue for bothPlaywrightFetcherandStealthyFetcheras both are using Playwright API so the result depends on Playwright's default behavior no more. - Added support for proxies that use SOCKS proxies in the
Fetcherclass. - Fixed the type hint for the
wait_selector_stateargument so now it will show the accurate values you should use while auto-completing.
Note
A friendly reminder that maintaining and improving Scrapling takes a lot of time and effort which I have been happily doing for months even though it's becoming harder. So, if you like Scrapling and want it to keep improving, you can help by supporting me through the Sponsor button.
v0.2.9
What's changed
New features
- Introducing the long-awaited async support for Scrapling! Now you have the
AsyncFetcherclass version ofFetcher, and bothStealthyFetcherandPlayWrightFetcherhave a new method calledasync_fetchwith the same options.
>> from scrapling import StealthyFetcher
>> page = await StealthyFetcher().async_fetch('https://www.browserscan.net/bot-detection') # the async version of fetch
>> page.status == 200
True-
Now the
StealthyFetcherclass has thegeoipargument in its fetch methods which when enabled makes the class automatically use IP's longitude, latitude, timezone, country, and locale, then spoof the WebRTC IP address. It will also calculate and spoof the browser's language based on the distribution of language speakers in the target region. -
Added the
retriesargument toFetcher/AsyncFetcherclasses so now you can set the number of retries of each request done byhttpx. -
Added the
url_joinmethod toAdaptorand Fetchers which takes a relative URL and joins it with the current URL to generate an absolute full URL! -
Added the
keep_cdatamethod toAdaptorand Fetchers to stop the parser from removing cdata when needed. -
Now
Adaptor/Responsebodymethod returns the raw HTML response when possible (without processing it in the library). -
Adding logging for the
Responseclass so now when you use the Fetchers you will get a log that gives info about the response you got.
Example:>> from scrapling.defaults import Fetcher >> Fetcher.get('https://books.toscrape.com/index.html') [2024-12-16 13:33:36] INFO: Fetched (200) <GET https://books.toscrape.com/index.html> (referer: https://www.google.com/search?q=toscrape) >>
-
Now using all standard string methods on a
TextHandlerlike.replace()will result in anotherTextHandler. It was returning the standard string before. -
Big improvements to speed across the library and improvements to stealth in Fetchers classes overall.
-
Added dummy functions like
extract_first`extract` which returns the same result as the parent. These functions are added only to make it easy to copy code from Scrapy/Parsel to Scrapling when needed as these functions are used there! -
Due to refactoring a lot of the code and using caching at the right positions, now doing requests in bulk will have a big speed increase.
Breaking changes
-
Now the support for Python 3.8 has been dropped. (Mainly because Playwright stopped supporting it but it was a problematic version anyway)
-
The
debugargument has been removed from all the library, now if you want to set the library to debugging, do this after importing the library:>>> import logging >>> logging.getLogger("scrapling").setLevel(logging.DEBUG)
Bugs Squashed
- Now WebGL is enabled by default as a lot of protections are checking if it's enabled now.
- Some mistakes and typos in the docs/README.
Quality of life changes
- All logging is now unified under the logger name
scraplingfor easier and cleaner control. We were using the root logger before. - Restructured the tests folder into a cleaner structure and added tests for the new features. All the tests were rewritten to a cleaner version and more tests were added for higher coverage.
- Refactored a big part of the code to be cleaner and easier to maintain.
All these changes were part of the changes I decided before to add with 0.3 but decided to add them here because it will be some time till the next version. Now the next step is to finish the detailed documentation website and then work on version 0.3
Note
A friendly reminder that maintaining and improving Scrapling takes a lot of time and effort which I have been happily doing for months even though it's becoming harder. So, if you like Scrapling and want it to keep improving, you can help by supporting me through the Sponsor button.
v0.2.8
What's changed
- This is a small update that includes some must-have quality-of-life changes to the code and fixed a typo in the main README file (#20)
Note
A friendly reminder that maintaining and improving Scrapling takes a lot of time and effort which I have been happily doing for months even though it's becoming harder. So, if you like Scrapling and want it to keep improving, you can help by supporting me through the Sponsor button.
v0.2.7
What's changed
New features
- Now if you used the
wait_selectorargument withStealthyFetcherandPlayWrightFetcherclasses, Scrapling will wait again for the JS to fully load and execute like normal. If you used thenetwork_idleargument, Scrapling will wait for it again too after waiting for all of that. If the states are all fulfilled then no waiting happens, of course. - Now you can enable and disable ads on
StealthyFetcherwith thedisable_adsargument. This is enabled by default and it installs theublock originaddon. - Now you can set the locale used by
PlayWrightFetcherwith thelocaleargument. The default value is stillen-US. - Now the basic requests done through
Fetchercan accept proxies in this formathttp://username:password@localhost:8030. - The stealth mode improved a bit for
PlayWrightFetcher.
Bugs Squashed/Improvements
- Now enabling proxies on the
PlayWrightFetcherclass is not tied to thestealthmode being on or off (Thanks to @AbdullahY36 for pointing that out) - Now the
ResponseEncodingtests if the encoding returned from the response can be used with the page or not. If the returned encoding triggered an error, Scrapling defaults toutf-8
Note
A friendly reminder that maintaining and improving Scrapling takes a lot of time and effort which I have been happily doing for months even though it's becoming harder. So, if you like Scrapling and want it to keep improving, you can help by supporting me through the Sponsor button.
v0.2.6
What's changed
New features
- Now the
PlayWrightFetchercan use the real browser directly with thereal_chromeargument passed to thePlayWrightFetcher.fetchfunction but this requires you to have Chrome browser installed. Scrapling will launch an instance of your Chrome browser and you can use most of the options as normal. (Before you only had thecdp_urlargument to do so) - Pumped up the version of headers generated for real browsers.
Bugs Squashed
- Turns out the format of the browser headers generated by
BrowserForgewas outdated which made Scrapling detected by some protections so nowBrowserForgeis only used to generate real useragent. - Now the
hide_canvasargument is turned off by default as it's being detected by Google's ReCaptcha.
Note
A friendly reminder that maintaining and improving Scrapling takes a lot of time and effort which I have been happily doing for months even though it's becoming harder. So, if you like Scrapling and want it to keep improving, you can help by supporting me through the Sponsor button.
