Skip to content

getter引入协程,tester中aiohttp的session优化 #92

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ikunjee
Copy link

@ikunjee ikunjee commented Sep 1, 2020

  1. crawler 中的爬取任务改用协程并发完成,由于异步方式,无法用 logger 记录当前正在爬取的网页了
  2. data5u.py 中重写的爬取方法也做了相应修改
  3. 原 tester 中,测试每个 proxy 都创建了一个 aiohttp.ClientSession,这有点浪费没有复用 session 的连接池,所以我增加了一个 main 方法用一个 session 处理了所有的代理测试。

@ikunjee ikunjee changed the title getter引入协程,aiohttp中的session优化 getter引入协程,tester中aiohttp的session优化 Sep 1, 2020
@Germey
Copy link
Member

Germey commented Sep 13, 2020

感谢贡献,我看其他的 Crawler 的 async 逻辑没有修改,这个其他的 Crawler 就没法用了吧,能麻烦一并修改下吗?

@ikunjee
Copy link
Author

ikunjee commented Sep 14, 2020

  • 没有重写 crawl 方法的 Crawler 默认用的 BaseCrawler 里面的 async crawl 方法,仍然可以用的。
  • 重写了 crawl 方法的就三个:data5u,xicidaili 和 zhandaye。data5u 的 async 逻辑我修改了,另外两个我改完后发现网站有问题,xicidaili 挂了,zhandaye 需要 cookie,不过我看到已经 ignore了,那就没事了。
  • 发现之前没注意到 Crawler 单文件运行代码没有修改,已修复,除了 ignore 外的 Crawler 均已测试成功。

@Germey
Copy link
Member

Germey commented Sep 14, 2020

多谢贡献,我会测试一下,没问题就 merge。

@everhopingandwaiting
Copy link
Contributor

everhopingandwaiting commented Feb 8, 2021

aiohttp 不支持 https 代理,这个比较不好,感觉没必要改成这样

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants