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

requests 库爬取网页时遇到 jQuery 的 val 函数设置的 Input 标签,无法获取 input 值

  •  1
     
  •   ArtCell · 2019-01-26 15:38:08 +08:00 · 1763 次点击
    这是一个创建于 1888 天前的主题,其中的信息可能已经有所发展或是发生改变。

    如题,有没有其他的方法能够获取

    5 条回复    2019-01-27 15:10:14 +08:00
    zhouzheng
        1
    zhouzheng  
       2019-01-26 16:17:21 +08:00   ❤️ 1
    Selenium+firefox,这个方案比较麻烦,爬起来也比较慢,但是可以解决所有 js 事件加载等问题。
    ArtCell
        2
    ArtCell  
    OP
       2019-01-26 16:24:13 +08:00
    @zhouzheng 感谢
    rekulas
        3
    rekulas  
       2019-01-26 20:55:10 +08:00
    我觉得 headless chrome 更好用些,不过如果页面不复杂的话,分析一下对方如何获取和设置数据的直接抓数据来源是最简单的。 基本的元素分析能力是爬虫工程师必备。
    xiaozizayang
        4
    xiaozizayang  
       2019-01-26 22:57:43 +08:00
    自写的框架 https://github.com/howie6879/ruia,支持 js 加载 你可以试试
    skinny
        5
    skinny  
       2019-01-27 15:10:14 +08:00
    Chrome 有一些奇奇怪怪的问题,比如截图有 Bug,还是 Firefox 稳定些。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3252 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 11:49 · PVG 19:49 · LAX 04:49 · JFK 07:49
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.