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

请教关于用 requests 模拟登陆的一个问题?

  •  
  •   ncesun · 2016-09-21 18:38:12 +08:00 · 1858 次点击
    这是一个创建于 2773 天前的主题,其中的信息可能已经有所发展或是发生改变。
    浏览器打开一个 url ,显示的是页面内容,但内容是个折叠的列表,需要手动点击全部展开才会显示内容,而程序抓取的页面不包含列表内的内容。
    在 url 上加入 &collapse=expandview 后,在浏览器上显示的页面是列表展开后的内容,但程序抓取的内容却是“正在打开列表,请稍后”之类的内容。
    请教一下,这是什么原因造成的?如何解决?
    4 条回复    2016-09-22 09:02:23 +08:00
    U2FsdGVkX1
        1
    U2FsdGVkX1  
       2016-09-21 18:40:11 +08:00
    页面是异步加载的,找找展开内容时的 ajax 地址
    popok
        2
    popok  
       2016-09-21 18:47:03 +08:00 via iPhone
    f12 ,点网络标签页,然后你点展开,看有哪个请求。

    和 1 楼一样的观点,肯定是 ajax
    jy02201949
        3
    jy02201949  
       2016-09-21 18:56:25 +08:00
    是时候上 selenium 这种重型武器了
    jpyl0423
        4
    jpyl0423  
       2016-09-22 09:02:23 +08:00
    2 楼已经说完了
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3288 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 12:33 · PVG 20:33 · LAX 05:33 · JFK 08:33
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.