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

写了个使用 Google Chrome Dev Protocol 来操作 chrome/headless chrome 的 Python Package

  •  
  •   fate0 ·
    fate0 · Aug 3, 2017 · 7030 views
    This topic created in 3201 days ago, the information mentioned may be changed or developed.

    项目地址: fate0/pychrome

    用处:

    直接使用 Google Chrome Dev Protocol 操作 chrome/headless chrome,比较灵活(前提要过一遍 Protocol) 。 更多信息请看 README.md

    为什么要写:

    想使用 headless chrome 来替换 PhantomJS 作爬虫,我找了一下,Python 好像并没有和 chrome-remote-interface 一样直接使用 Chrome DevTools Protocol 来操作 chrome 的 Package,后面就自己写了一个。

    最后:

    欢迎各种 star、issue 以及 pr (。・`ω´・)

    12 replies    2018-05-11 06:55:07 +08:00
    chengxiao
        1
    chengxiao  
       Aug 3, 2017
    和 selenium 的区别是???
    CryMeatel
        2
    CryMeatel  
       Aug 3, 2017
    赞~ 又见 fate 大神~
    JhZ7z587cYROBgVQ
        3
    JhZ7z587cYROBgVQ  
       Aug 3, 2017
    感觉有点意思,但是看了下代码,是不是支持的功能有点少?
    w0000
        4
    w0000  
       Aug 3, 2017
    @chengxiao selenium 在速度上还是慢了点
    fate0
        5
    fate0  
    OP
       Aug 3, 2017
    @chengxiao 区别是更接近 Dev Protocol 吧,selenium 依赖 ChromeDriver,然而 ChromeDriver 还是使用 Dev Protocol 来操作 chrome (这段话单讲 chrome...)
    fate0
        6
    fate0  
    OP
       Aug 3, 2017
    @jason0916 功能多不多,主要看 dev protocol 开放的接口多不多,chrome 61 之后多了个 Network.requestIntercepted,看到这个 method,我就觉得 headless chrome 能够写爬虫了。
    knightdf
        7
    knightdf  
       Aug 3, 2017
    我觉得单论爬虫 splash 比 selenium 好用点
    Fen2g
        8
    Fen2g  
       Aug 3, 2017
    已 star,公司已经有在用不过是 node。这个 python 希望楼主继续加油!
    scys
        9
    scys  
       Aug 3, 2017
    Stared :D
    挺好,近来研究自动化家庭框架。用得上。
    slideclick
        10
    slideclick  
       Aug 3, 2017
    看楼主破解了 ruby 的混乱工具,搭车问一下,python 有比较好的混乱工具么?
    fate0
        11
    fate0  
    OP
       Aug 3, 2017
    @slideclick 简单的方法就是转成 c 代码,需要保密的代码我直接用 go 写
    atsummer
        12
    atsummer  
       May 11, 2018
    好不容易找到的,已经 star,感谢楼主^_^
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2671 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 76ms · UTC 15:50 · PVG 23:50 · LAX 08:50 · JFK 11:50
    ♥ Do have faith in what you're doing.