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

请问 Django+Selenium+Requests+Chrome 的可以接受多个请求的爬虫程序该如何实现?

  •  
  •   KevinBu · Jan 8, 2019 · 2083 views
    This topic created in 2824 days ago, the information mentioned may be changed or developed.
    目前使用 threading 创建多个线程,因为要使用帐号模拟登陆,所以帐号数就等于可创建线程数。

    用 queue 分配任务队列,如果所有的帐号都处于使用状态,就.put 这个请求而不去执行爬虫,然后等一个线程爬取完毕就.get 一下继续爬,如此循环。

    可能我描述的不大清楚,请问各位大佬有没有好的思路?
    2 replies  •  2019-01-11 11:07:04 +08:00
    ChangHaoWei
        1
    ChangHaoWei  
       Jan 8, 2019
    无语 涉及 celery + 线程池?

    实测,谷歌浏览器同时在线个数为 60 个,,一般主机
    15399905591
        2
    15399905591  
       Jan 11, 2019
    你把爬虫做成一个异步任务,一个接口接受任务,接受了任务就往队列推送一个任务,然后返回一个任务 ID,爬虫任务执行完了就把结果保存起来,再做一个接口查询爬虫的任务结果。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1223 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 16:40 · PVG 00:40 · LAX 09:40 · JFK 12:40
    ♥ Do have faith in what you're doing.