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

Python 爬虫抓取 Ajax 动态评论

  •  
  •   buxiangshuo · Mar 20, 2014 · 8977 views
    This topic created in 4451 days ago, the information mentioned may be changed or developed.
    http://comment5.news.sina.com.cn/comment/skin/default.html?channel=gn&newsid=1-1-29714243

    通过chrome控制台简单粗暴得到json数据url,但是只能得到有限的评论。新浪新闻的评论都是动态加载的,不懂ajax也不太明白如何模拟header头,第一次写爬虫,真心累觉不爱啊,请哪位大神帮帮忙看下如何解决?最好详细一点,本人这方面小白一个 = _ =||

    不胜感激!!!
    10 replies    2017-07-11 09:06:10 +08:00
    binux
        1
    binux  
       Mar 20, 2014   ❤️ 2
    不懂就去弄懂
    zoowii
        2
    zoowii  
       Mar 20, 2014
    Google
    wangfengmadking
        3
    wangfengmadking  
       Mar 20, 2014
    selenium或者PhantomJS都可以解决你的问题
    yanpeipan
        4
    yanpeipan  
       Mar 20, 2014
    python+selenium+PhantomJS
    Livid
        5
    Livid  
    MOD
    PRO
       Mar 20, 2014 via iPhone   ❤️ 2
    import requests

    headers = { ... }
    url = ...
    r = requests.get(url, headers=headers)
    buxiangshuo
        6
    buxiangshuo  
    OP
       Mar 20, 2014
    感谢大家!问题已经解决啦~
    s51431980
        7
    s51431980  
       Mar 20, 2014
    @buxiangshuo 楼主怎么解决的,介绍一下思路?
    zxc337
        8
    zxc337  
       Mar 20, 2014
    怎么解决的,发我看看
    keven
        9
    keven  
       Mar 26, 2014
    解决了公布一下解决方式呗,ajax不难的,我做采集很多,用工具直接搞定
    ikeeper
        10
    ikeeper  
       Jul 11, 2017
    帖主咋弄的,求指教啊,捣鼓半天发现 js 请求后面跟了一个随机数,不知道怎么继续了
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   4365 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 48ms · UTC 00:10 · PVG 08:10 · LAX 17:10 · JFK 20:10
    ♥ Do have faith in what you're doing.