-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ikunjee
ikunjee
commented
Sep 1, 2020
- crawler 中的爬取任务改用协程并发完成,由于异步方式,无法用 logger 记录当前正在爬取的网页了
- data5u.py 中重写的爬取方法也做了相应修改
- 原 tester 中,测试每个 proxy 都创建了一个 aiohttp.ClientSession,这有点浪费没有复用 session 的连接池,所以我增加了一个 main 方法用一个 session 处理了所有的代理测试。
@ikunjee
ikunjee
changed the title
(削除) getter引入协程,aiohttp中的session优化 (削除ここまで)
(追記) getter引入协程,tester中aiohttp的session优化 (追記ここまで)
Sep 1, 2020
感谢贡献,我看其他的 Crawler 的 async 逻辑没有修改,这个其他的 Crawler 就没法用了吧,能麻烦一并修改下吗?
- 没有重写 crawl 方法的 Crawler 默认用的 BaseCrawler 里面的 async crawl 方法,仍然可以用的。
- 重写了 crawl 方法的就三个:data5u,xicidaili 和 zhandaye。data5u 的 async 逻辑我修改了,另外两个我改完后发现网站有问题,xicidaili 挂了,zhandaye 需要 cookie,不过我看到已经 ignore了,那就没事了。
- 发现之前没注意到 Crawler 单文件运行代码没有修改,已修复,除了 ignore 外的 Crawler 均已测试成功。
多谢贡献,我会测试一下,没问题就 merge。
aiohttp 不支持 https 代理,这个比较不好,感觉没必要改成这样
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.