Scrapy download handler that can impersonate browser TLS signatures
Project description
scrapy-rnet
A Scrapy download handler that enables browser TLS fingerprint impersonation using the rnet library.
Features
- Seamlessly integrates with Scrapy's download system
- Impersonates browser TLS signatures to evade detection
- Supports multiple browser versions for impersonation
Installation
pip install scrapy-rnet
Requirements
- Python 3.12+
- rnet >= 2.1.0
- scrapy >= 2.12.0
Usage
Basic Setup
- Configure the download handlers in your Scrapy settings:
DOWNLOAD_HANDLERS = {
"http": "scrapy_rnet.handler.ImpersonateDownloadHandler",
"https": "scrapy_rnet.handler.ImpersonateDownloadHandler",
}
USER_AGENT = None
# Required for async operation
TWISTED_REACTOR = "twisted.internet.asyncioreactor.AsyncioSelectorReactor"
- Enable impersonation for specific requests by adding
impersonateto the request metadata:
from rnet import Impersonate, ImpersonateOS
yield scrapy.Request(
url="https://example.com",
meta={
"impersonate": Impersonate.Chrome132,
"impersonate_os": ImpersonateOS.Windows # Optional
},
callback=self.parse
)
Example Spider
import scrapy
from scrapy.http import Request, Response
from rnet import Impersonate, ImpersonateOS
class BrowserImpersonationSpider(scrapy.Spider):
name = "browser_impersonation"
custom_settings = {
"DOWNLOAD_HANDLERS": {
"http": "scrapy_rnet.handler.ImpersonateDownloadHandler",
"https": "scrapy_rnet.handler.ImpersonateDownloadHandler",
},
"TWISTED_REACTOR": "twisted.internet.asyncioreactor.AsyncioSelectorReactor",
"USER_AGENT": None
}
def start_requests(self):
url = "https://httpbin.org/headers"
yield Request(
url=url,
meta={
"impersonate": Impersonate.Chrome132,
"impersonate_os": ImpersonateOS.Windows # Optional
},
callback=self.parse
)
def parse(self, response):
self.logger.info(response.text)
Available Impersonation Options
The package supports a wide range of browser versions and operating systems:
Browser Versions
| Browser | Versions |
|---|---|
| Chrome | Chrome100, Chrome101, Chrome104, Chrome105, Chrome106, Chrome107, Chrome108, Chrome109, Chrome114, Chrome116, Chrome117, Chrome118, Chrome119, Chrome120, Chrome123, Chrome124, Chrome126, Chrome127, Chrome128, Chrome129, Chrome130, Chrome131, Chrome132, Chrome133, Chrome134 |
| Edge | Edge101, Edge122, Edge127, Edge131, Edge134 |
| Safari | SafariIos17_2, SafariIos17_4_1, SafariIos16_5, Safari15_3, Safari15_5, Safari15_6_1, Safari16, Safari16_5, Safari17_0, Safari17_2_1, Safari17_4_1, Safari17_5, Safari18, SafariIPad18, Safari18_2, Safari18_1_1, Safari18_3, Safari18_3_1 |
| OkHttp | OkHttp3_9, OkHttp3_11, OkHttp3_13, OkHttp3_14, OkHttp4_9, OkHttp4_10, OkHttp4_12, OkHttp5 |
| Firefox | Firefox109, Firefox117, Firefox128, Firefox133, Firefox135, FirefoxPrivate135, FirefoxAndroid135, Firefox136, FirefoxPrivate136 |
Operating Systems
WindowsMacOSLinuxAndroidIOS
Credits
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
scrapy_rnet-0.0.2.tar.gz
(3.9 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file scrapy_rnet-0.0.2.tar.gz.
File metadata
- Download URL: scrapy_rnet-0.0.2.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
56e8b1acbb27ff2ce416c4c2ef3fa8a05036ad7fb62fd0a95dde266d3068e01a
|
|
| MD5 |
3a0f6d9efa4ff21d428b46559ff03fd5
|
|
| BLAKE2b-256 |
8d0bec253bf7dc6296c62b97419c037fb39b85766888bf2de9e9033e1de5f1e5
|
File details
Details for the file scrapy_rnet-0.0.2-py3-none-any.whl.
File metadata
- Download URL: scrapy_rnet-0.0.2-py3-none-any.whl
- Upload date:
- Size: 4.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d320d1169935d007d78a4497e9acac22277c2d5179f0c005f439ac5bb5d259fa
|
|
| MD5 |
d6c4f487bc4767a9e639ba745681a43c
|
|
| BLAKE2b-256 |
116925f2b1fa4e3a864b8380cd3598ced098ef4ea679f9156e417031220069df
|