Skip to content

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
perklet committed Nov 29, 2023
1 parent b150a56 commit efb322c
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 6 deletions.
27 changes: 25 additions & 2 deletions README-zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ TLS 或者 JA3 指纹。如果你莫名其妙地被某个网站封锁了,可
- 支持 `asyncio`,并且每个请求都可以换代理。
- 支持 http 2.0,requests 不支持。

||requests|aiohttp|httpx|pycurl|curl_cffi|
|---|---|---|---|---|---|
|http2||||||
|sync||||||
|async||||||
|指纹||||||
|速度|🐇|🐇🐇|🐇|🐇🐇|🐇🐇|

## 安装

pip install curl_cffi --upgrade
Expand All @@ -23,8 +31,14 @@ TLS 或者 JA3 指纹。如果你莫名其妙地被某个网站封锁了,可
在其他小众平台,你可能需要先编译并安装 `curl-impersonate` 并且设置 `LD_LIBRARY_PATH` 这些
环境变量。

安装测试版:

pip install curl_cffi --pre

## 使用

尽量模仿比较新的浏览器,不要直接从下边的例子里复制 `chrome110` 去用。

### 类 requests

```python
Expand Down Expand Up @@ -59,7 +73,9 @@ print(r.json())
# {'cookies': {'foo': 'bar'}}
```

支持模拟的浏览器版本,和 [curl-impersonate](https://github.com/lwthiker/curl-impersonate) 一致:
支持模拟的浏览器版本,和我 [fork](https://github.com/yifeikong/curl-impersonate)[curl-impersonate](https://github.com/lwthiker/curl-impersonate) 一致:

不过只支持类似 Chrome 的浏览器。

- chrome99
- chrome100
Expand All @@ -68,6 +84,10 @@ print(r.json())
- chrome107
- chrome110
- chrome116
- chrome117
- chrome118
- chrome119
- chrome120
- chrome99_android
- edge99
- edge101
Expand Down Expand Up @@ -126,7 +146,10 @@ print(body.decode())

更多细节请查看 [英文文档](https://curl-cffi.readthedocs.io)

如果你用 scrapy 的话,可以参考这个中间件:[tieyongjie/scrapy-fingerprint](https://github.com/tieyongjie/scrapy-fingerprint)
如果你用 scrapy 的话,可以参考这些中间件:

- [tieyongjie/scrapy-fingerprint](https://github.com/tieyongjie/scrapy-fingerprint)
- [jxlil/scrapy-impersonate](https://github.com/jxlil/scrapy-impersonate)

有问题和建议请优先提 issue,中英文均可,也可以加微信群交流讨论:

Expand Down
15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ To install beta releases:

## Usage

Use the latest impersonate versions, do NOT copy `chrome110` here without changing.

### requests-like

```python
Expand Down Expand Up @@ -74,7 +76,9 @@ print(r.json())
# {'cookies': {'foo': 'bar'}}
```

Supported impersonate versions, as supported by [curl-impersonate](https://github.com/lwthiker/curl-impersonate):
Supported impersonate versions, as supported by my [fork](https://github.com/yifeikong/curl-impersonate) of [curl-impersonate](https://github.com/lwthiker/curl-impersonate):

However, only Chrome-like browsers are supported.

- chrome99
- chrome100
Expand All @@ -83,6 +87,10 @@ Supported impersonate versions, as supported by [curl-impersonate](https://githu
- chrome107
- chrome110
- chrome116
- chrome117
- chrome118
- chrome119
- chrome120
- chrome99_android
- edge99
- edge101
Expand Down Expand Up @@ -141,7 +149,10 @@ print(body.decode())

See the [docs](https://curl-cffi.readthedocs.io) for more details.

If you are using scrapy, check out this middleware: [tieyongjie/scrapy-fingerprint](https://github.com/tieyongjie/scrapy-fingerprint)
If you are using scrapy, check out these middlewares:

- [tieyongjie/scrapy-fingerprint](https://github.com/tieyongjie/scrapy-fingerprint)
- [jxlil/scrapy-impersonate](https://github.com/jxlil/scrapy-impersonate)

## Acknowledgement

Expand Down
4 changes: 4 additions & 0 deletions curl_cffi/requests/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ class BrowserType(str, Enum):
chrome107 = "chrome107"
chrome110 = "chrome110"
chrome116 = "chrome116"
chrome117 = "chrome117"
chrome118 = "chrome118"
chrome119 = "chrome119"
chrome120 = "chrome120"
chrome99_android = "chrome99_android"
safari15_3 = "safari15_3"
safari15_5 = "safari15_5"
Expand Down
4 changes: 2 additions & 2 deletions preprocess/download_so.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ def reporthook(blocknum, blocksize, totalsize):
url = ""
filename = "./curl-impersonate.tar.gz"
else:
url = f"https://github.com/lwthiker/curl-impersonate/releases/download/v{VERSION}/libcurl-impersonate-v{VERSION}.{uname.machine}-macos.tar.gz"
url = f"https://github.com/yifeikong/curl-impersonate/releases/download/v{VERSION}/libcurl-impersonate-v{VERSION}.{uname.machine}-macos.tar.gz"
filename = "./curl-impersonate.tar.gz"
elif uname.system == "Windows":
url = f"https://github.com/yifeikong/curl-impersonate-win/releases/download/v{VERSION}/curl-impersonate-chrome.tar.gz"
filename = "./curl-impersonate.tar.gz"
else:
url = f"https://github.com/lwthiker/curl-impersonate/releases/download/v{VERSION}/libcurl-impersonate-v{VERSION}.{uname.machine}-linux-gnu.tar.gz"
url = f"https://github.com/yifeikong/curl-impersonate/releases/download/v{VERSION}/libcurl-impersonate-v{VERSION}.{uname.machine}-linux-gnu.tar.gz"
filename = "./curl-impersonate.tar.gz"

if url:
Expand Down

0 comments on commit efb322c

Please sign in to comment.