推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
1oscar
V2EX  ›  Python

qunar; 爬虫;遇到 wyf 参数和_token 参数,如何获取??

  •  
  •   1oscar · May 25, 2015 · 4434 views
    This topic created in 4029 days ago, the information mentioned may be changed or developed.

    爬qunar的机票网页,遇到需要wyf参数和_token参数,如何获取


    1. 打开 http://www.qunar.com/,随便选择出发站到达站
    2. google开发工具,network里的longwell?******链接里
    3. headersRequest URL:需要这两个个参数,
    
    wyf:uJb7S3JT6lF7EzJEzm+dTzAbuN+w23JEuqFdl+3vlNJ7l+ob|1432560216540
    _token:91951
    
    发现这两个参数对于不同的行程是在变化的,不知道怎么获取到呀
    

    求助朋友们指教下

    10 replies    2015-05-26 20:44:53 +08:00
    kslr
        1
    kslr  
       May 25, 2015
    csft_token ?
    y....
    w88975
        2
    w88975  
       May 25, 2015
    一般这种token,是存在于html页面的源码里面,请求页面的时候,把源码中的token用正则取出来就好
    1oscar
        3
    1oscar  
    OP
       May 25, 2015
    @w88975 token是小事,主要是wyf参数网页里没找到呀
    1oscar
        4
    1oscar  
    OP
       May 25, 2015
    @kslr 不是的,主要是wyf参数值不知道怎么来的
    facat
        5
    facat  
       May 26, 2015
    为什么要爬这两个值?你直接爬机票就可以了。我就爬过。不过用的是phantomjs,但是原理一样。
    crab
        6
    crab  
       May 26, 2015
    wyf 参数从这 http://qunarzz.com/flight/prd/scripts/v4_oneway_list@*.js 浏览器的 UA 吧 ?
    1oscar
        7
    1oscar  
    OP
       May 26, 2015
    @facat 直接爬机票是可以,只是爬下来数据总是有些缺失,所以感觉可能和这两个参数有关
    1oscar
        8
    1oscar  
    OP
       May 26, 2015
    @crab 主要是那段js代码没看明白
    facat
        9
    facat  
       May 26, 2015
    @1oscar 用phantomjs吧,qunar用了很多ajax,直接爬不方便。
    1oscar
        10
    1oscar  
    OP
       May 26, 2015
    @facat 谢谢你
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   873 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 37ms · UTC 21:10 · PVG 05:10 · LAX 14:10 · JFK 17:10
    ♥ Do have faith in what you're doing.