V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
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 · 2015-05-25 22:23:44 +08:00 · 3941 次点击
    这是一个创建于 3264 天前的主题,其中的信息可能已经有所发展或是发生改变。

    爬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 条回复    2015-05-26 20:44:53 +08:00
    kslr
        1
    kslr  
       2015-05-25 22:26:31 +08:00
    csft_token ?
    y....
    w88975
        2
    w88975  
       2015-05-25 22:42:38 +08:00
    一般这种token,是存在于html页面的源码里面,请求页面的时候,把源码中的token用正则取出来就好
    1oscar
        3
    1oscar  
    OP
       2015-05-25 23:50:43 +08:00
    @w88975 token是小事,主要是wyf参数网页里没找到呀
    1oscar
        4
    1oscar  
    OP
       2015-05-25 23:51:39 +08:00
    @kslr 不是的,主要是wyf参数值不知道怎么来的
    facat
        5
    facat  
       2015-05-26 01:12:29 +08:00
    为什么要爬这两个值?你直接爬机票就可以了。我就爬过。不过用的是phantomjs,但是原理一样。
    crab
        6
    crab  
       2015-05-26 03:18:53 +08:00
    wyf 参数从这 http://qunarzz.com/flight/prd/scripts/v4_oneway_list@*.js 浏览器的 UA 吧 ?
    1oscar
        7
    1oscar  
    OP
       2015-05-26 08:25:25 +08:00
    @facat 直接爬机票是可以,只是爬下来数据总是有些缺失,所以感觉可能和这两个参数有关
    1oscar
        8
    1oscar  
    OP
       2015-05-26 08:28:34 +08:00
    @crab 主要是那段js代码没看明白
    facat
        9
    facat  
       2015-05-26 11:09:38 +08:00
    @1oscar 用phantomjs吧,qunar用了很多ajax,直接爬不方便。
    1oscar
        10
    1oscar  
    OP
       2015-05-26 20:44:53 +08:00
    @facat 谢谢你
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2252 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 05:45 · PVG 13:45 · LAX 22:45 · JFK 01:45
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.