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

闲聊

  •  
  •   andmspy · Apr 9, 2017 · 3371 views
    This topic created in 3458 days ago, the information mentioned may be changed or developed.

    刚刚安装了 selenium 库,发现用这个方法找 id 为‘ cp ’的元素,又快又方便。 driver = webdriver.PhantomJS() driver.get('http://www.baidu.com') data = driver.find_element_by_id('cp').text print(data)

    后来打开浏览器 chrome 右键检查缺没有发现 id=‘ cp' 这个标签元素,难道浏览器里面隐藏了这个 id=’ cp ‘吗?

    还有发现百度在开发者模式里面发了招聘广告,藏得太深了吧。

    111111111111
        1
    111111111111  
       Apr 10, 2017 via Android
    有些元素是 js 创建的,右键源代码不一定看得到
    F12 就可以看到的招聘信息,隐藏的不算深吧
    acheapskate
        2
    acheapskate  
       Apr 10, 2017 via Android
    哈哈哈 我前几天也是这样。不点击页面中的 js 触发按钮的话,相关代码是不会出现在检查里的! 而且这个库可以 模仿点击 这种按钮。

    🤔🤔连续发了两个爬虫主题,关注你了。对了,代码没换行吧?
    andmspy
        3
    andmspy  
    OP
       Apr 10, 2017 via Android
    @acheapskate 我手机上没注意看,你学到哪了?我们多交流吧
    acheapskate
        4
    acheapskate  
       Apr 10, 2017 via Android
    @andmspy 在用 bs4 和你提到的 selenium ,有本书挺好的叫 python 网络数据采集。我是看这本书才知道这个库的🤔。 要不加个微信?我读大学,看到你高中就学这些东西,好 6 啊
    andmspy
        5
    andmspy  
    OP
       Apr 10, 2017 via Android
    @acheapskate 那本书我也有,还在看第一章呢。我微信 andmspy
    acheapskate
        6
    acheapskate  
       Apr 10, 2017 via Android
    @andmspy 加了🤔🤔
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   820 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 20:45 · PVG 04:45 · LAX 13:45 · JFK 16:45
    ♥ Do have faith in what you're doing.