Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

New issue

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

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

Already on GitHub? Sign in to your account

Open
ikunjee wants to merge 2 commits into Python3WebSpider:master
base: master
Choose a base branch
Loading
from ikunjee:coroutine-dev

Conversation

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
Copy link
Member

Germey commented Sep 13, 2020

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

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 均已测试成功。

Copy link
Member

Germey commented Sep 14, 2020

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

Copy link
Contributor

everhopingandwaiting commented Feb 8, 2021
edited
Loading

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /