Scrapy middleware with TOR support for more robust scrapers or anonymous scraping.
Project description
scrapy-tor-downloader
Scrapy middleware with TOR support for more robust scrapers or anonymous scraping.
Dependencies :globe_with_meridians:
Installation :inbox_tray:
This is a python package hosted on pypi, so to install simply run the following command:
pip install scrapy-tor-downloader
Settings
TOR_PROXY_ENABLED
Whether TOR is used to proxy any request (defaults to false).
Meta field to enable/disable this per request is: tor_proxy_enabled
TOR_FALLBACK_ENABLED
Whether TOR is used when a request fails as a fallback (defaults to true).
Meta field to enable/disable this per request is: tor_fallback_enabled
TOR2WEB_PROXY
Whether a tor2web proxy is used for onion address. The value of this setting is the domain for the proxy.
Meta field to add this per request is: tor2web_proxy
tor_reset_session
Whether to reset the TOR session before processing the request. This field only exists in the meta on the request as tor_reset_session
and is a boolean.
Usage example :eyes:
In order to use this plugin simply add the following settings and substitute your variables:
DOWNLOADER_MIDDLEWARES = {
"tormiddleware.middleware.TORDownloaderMiddleware": 631
}
This will immediately allow you begin using TOR as a fallback when one of your requests fail. In order to use it as a proxy you can add the following to your settings:
TOR_PROXY_ENABLED = True
This will make every request hit TOR for a response. If you have turned the proxy on the TOR fallback is ignored, however if it is off the fallback is still on by default, which means if a request returns an error it will be tried again on TOR. In order to turn this off add the following to your settings:
TOR_FALLBACK_ENABLED = False
If you want to make use of tor2web proxies for onion addresses, you can add it to the settings like so:
TOR2WEB_PROXY = "https://onion.moe"
License :memo:
The project is available under the MIT License.
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
File details
Details for the file scrapy-tor-downloader-1.0.4.tar.gz
.
File metadata
- Download URL: scrapy-tor-downloader-1.0.4.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 421b2fbdddca913be84878fc99cf1693bf3ef67378877d3e421d24a719fb6873 |
|
MD5 | 67737b17ed6993fb09a96bb6461ce20b |
|
BLAKE2b-256 | e79a6eb4d8049d88ee7ebdfa59cb9021b2fc06a9f3432d89b266e6a081a4a859 |