V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
推荐学习书目
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 · Sep 21, 2016 · 2644 views
    This topic created in 3515 days ago, the information mentioned may be changed or developed.
    浏览器打开一个 url ,显示的是页面内容,但内容是个折叠的列表,需要手动点击全部展开才会显示内容,而程序抓取的页面不包含列表内的内容。
    在 url 上加入 &collapse=expandview 后,在浏览器上显示的页面是列表展开后的内容,但程序抓取的内容却是“正在打开列表,请稍后”之类的内容。
    请教一下,这是什么原因造成的?如何解决?
    4 replies    2016-09-22 09:02:23 +08:00
    U2FsdGVkX1
        1
    U2FsdGVkX1  
       Sep 21, 2016
    页面是异步加载的,找找展开内容时的 ajax 地址
    popok
        2
    popok  
       Sep 21, 2016 via iPhone
    f12 ,点网络标签页,然后你点展开,看有哪个请求。

    和 1 楼一样的观点,肯定是 ajax
    jy02201949
        3
    jy02201949  
       Sep 21, 2016
    是时候上 selenium 这种重型武器了
    jpyl0423
        4
    jpyl0423  
       Sep 22, 2016
    2 楼已经说完了
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   4264 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 55ms · UTC 00:56 · PVG 08:56 · LAX 17:56 · JFK 20:56
    ♥ Do have faith in what you're doing.