推荐学习书目
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
yutian2211
V2EX  ›  Python

请教一个爬虫问题, scrapy 访问被转向手机站

  •  
  •   yutian2211 · Jul 14, 2016 · 3223 views
    This topic created in 3640 days ago, the information mentioned may be changed or developed.
    为啥我使用 scrapy 来抓取 http://www.fieldschina.com/zh/index.html ,他都会直接 302 转向 m.fieldschina.com?
    我伪造了 User Agent ,不应该是通过 user Agent 来判断的,电脑上用 Chrome 打开正常,说明不是通过 ip 来判断的。
    我使用 Chrome 隐私模式来访问,结果也正常,觉得应该不是 cookies 来判断。。
    看一下 response header,用的是 php...

    请教一下大家,我的思路有没问题? php 识别客户端正常使用的是什么方法 ?哪些变量?

    非常感谢!
    4 replies    2016-07-15 09:44:36 +08:00
    Moker
        1
    Moker  
       Jul 14, 2016   ❤️ 1
    直接 curl 并没有你说的那个问题啊
    binux
        2
    binux  
       Jul 14, 2016   ❤️ 1
    就是 UA ,确认你的 UA 设置对了。
    yalay
        3
    yalay  
       Jul 14, 2016   ❤️ 1
    同意楼上,就是 ua 关键词判断, ua 设置为 PC 上的 ua 。
    yutian2211
        4
    yutian2211  
    OP
       Jul 15, 2016
    感谢,我的 UA 在总开关那设置有问题,谢谢
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   6106 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 53ms · UTC 02:10 · PVG 10:10 · LAX 19:10 · JFK 22:10
    ♥ Do have faith in what you're doing.