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
yutian2211
V2EX  ›  Python

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

  •  
  •   yutian2211 · 2016-07-14 18:16:55 +08:00 · 2573 次点击
    这是一个创建于 2835 天前的主题,其中的信息可能已经有所发展或是发生改变。
    为啥我使用 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 条回复    2016-07-15 09:44:36 +08:00
    Moker
        1
    Moker  
       2016-07-14 18:20:33 +08:00   ❤️ 1
    直接 curl 并没有你说的那个问题啊
    binux
        2
    binux  
       2016-07-14 18:26:28 +08:00   ❤️ 1
    就是 UA ,确认你的 UA 设置对了。
    yalay
        3
    yalay  
       2016-07-14 18:31:13 +08:00   ❤️ 1
    同意楼上,就是 ua 关键词判断, ua 设置为 PC 上的 ua 。
    yutian2211
        4
    yutian2211  
    OP
       2016-07-15 09:44:36 +08:00
    感谢,我的 UA 在总开关那设置有问题,谢谢
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1266 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 17:54 · PVG 01:54 · LAX 10:54 · JFK 13:54
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.