Git Product home page Git Product logo

ctrip_spider's Introduction

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.