携程爬虫(破解eleven, 发现ctrip_ticket)
使用时先跑'gen_ticket.py'生成ctrip_ticket,再跑'main.py'
破解eleven参数后,可以不需要调用selenium便可请求到详细的价格信息,提升获取速度、减少资源占用
该爬虫可爬取:
- 每个酒店名称、评分
- 每个酒店不同预订时间每种房型价格
- 每个酒店不同预订时间每种房型满意度
- 每个酒店不同预订时间每种房型剩余可订数
1. 获得房间价格的重要参数"eleven"的生成方法
- "eleven"由一个混淆js文件-"oceanball"生成,该文件具有随机性
- 生成方法:ctrip_funcs.py中的"get_oceanball"、"get_eleven"两个函数,需要配合js代码和python共同生成
2. 发现获得剩余可订房间仅需要Cookie: ctrip_ticket
- 这个cookie疑似使用“Http-only”Flag 发送,无法直接读取,只能通过浏览器获得。(reference)
- 该cookie时效较长,可以用selenium每30分钟提取一次
Metadata
Release files for ctrip-spider 1.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ctrip_spider-1.1.5.tar.gz | 3.6 kB | Without provenance | Details for ctrip_spider-1.1.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ctrip_spider-1.1.5-py3-none-any.whl | Python 3 | none | any | Details for ctrip_spider-1.1.5-py3-none-any.whl |
Total release size: 6.6 kB
Release files / ctrip_spider-1.1.5.tar.gz
| Download URL | ctrip_spider-1.1.5.tar.gz |
|---|---|
| Size | 3.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f46269ba3a35be365adf792587de927e853ebf3d02ac15559e08e13c16fe0212
|
|
BLAKE2b-256 checksum How to use checksums |
26fa43b56f341c8d0ca75580c7a8279aa9a0318f2c3fef7346e346430464bc64
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.11.2
|
Release files / ctrip_spider-1.1.5-py3-none-any.whl
| Download URL | ctrip_spider-1.1.5-py3-none-any.whl |
|---|---|
| Size | 3.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4d9aa4b3398a5cb5f3a8cecdc76282c2e9fdaf05e5b341d420d732d546768314
|
|
BLAKE2b-256 checksum How to use checksums |
fc2aa03fad89181b1f6749609b54197b09a124b215e642f0e363cbdc2a97d3d6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.11.2
|
Security for ctrip-spider 1.1.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.