Skip to main content

携程爬虫(破解eleven, 发现ctrip_ticket).

Project description

携程爬虫(破解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分钟提取一次

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

ctrip_spider-1.1.5.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

ctrip_spider-1.1.5-py3-none-any.whl (3.0 kB view details)

Uploaded Python 3

File details

Details for the file ctrip_spider-1.1.5.tar.gz.

File metadata

  • Download URL: ctrip_spider-1.1.5.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.11.2

File hashes

Hashes for ctrip_spider-1.1.5.tar.gz
Algorithm Hash digest
SHA256 f46269ba3a35be365adf792587de927e853ebf3d02ac15559e08e13c16fe0212
MD5 4ddff251b0aa23ff1f0874af4064d896
BLAKE2b-256 26fa43b56f341c8d0ca75580c7a8279aa9a0318f2c3fef7346e346430464bc64

See more details on using hashes here.

Provenance

File details

Details for the file ctrip_spider-1.1.5-py3-none-any.whl.

File metadata

File hashes

Hashes for ctrip_spider-1.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 4d9aa4b3398a5cb5f3a8cecdc76282c2e9fdaf05e5b341d420d732d546768314
MD5 d0acad434afc4eda0cb6fd43b1bc27c6
BLAKE2b-256 fc2aa03fad89181b1f6749609b54197b09a124b215e642f0e363cbdc2a97d3d6

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page