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):
urls = [
"https://example.com",
"https://httpbin.org/headers"
]
for url in urls:
yield Request(
url=url,
meta={
"impersonate": Impersonate.Chrome132,
"impersonate_os": ImpersonateOS.Windows # Optional
},
callback=self.parse
)
def parse(self, response):
yield {
"url": response.url,
"status": response.status,
"flags": response.flags
}
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.1.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.1.tar.gz.
File metadata
- Download URL: scrapy_rnet-0.0.1.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 |
cf3c0dfbcf6ac88e35faffe1cbe5cdd42b683e2e8d68cbdf5186a74a9c216a95
|
|
| MD5 |
ffabca6aeca8c07fd33714e26985f237
|
|
| BLAKE2b-256 |
0efd29979bc1f24211260959e8834d3e3e24344f48759c119967ef78482d0289
|
File details
Details for the file scrapy_rnet-0.0.1-py3-none-any.whl.
File metadata
- Download URL: scrapy_rnet-0.0.1-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b0d0726506c5758e4b4cf9ca816fbc8e22ef083e2ddc70885fb69b8b955acddd
|
|
| MD5 |
30165ee42400192279a3fc763544581f
|
|
| BLAKE2b-256 |
66bc3fc3bddd02d04737b997b5c26fd11a74252ee86ff5b037dd6fdab513ebdf
|