CWHer / PixivCrawler

Pixiv Utils implemented in Python, including Pixiv Crawler and Mosaic Puzzles, support for rankings, personal bookmarks, artist works and keyword search for personalized filtering, and provide high-performance multi-threaded parallel download. 🤗
GNU General Public License v3.0
214 stars 28 forks source link

Use `asyncio` to replace `thread_pool` #5

Closed kingwingfly closed 1 year ago

kingwingfly commented 1 year ago

I wanna use httpx to make the downloader faster.
Compared with requests, httpx is faster due to supporting asynicio.

我可以为这个项目的下载部分实现异步httpx吗?那样子更快。

kingwingfly commented 1 year ago

抱歉才发现您用的多线程。。。

顺便请问一下 https://www.pixiv.net/ajax/user/23945843/profile/all?lang=zh这个链接是如何确定的呢?

CWHer commented 1 year ago

I wanna use https to make the downloader faster. Compared with requests, httpx is faster due to supporting asynicio.

我可以为这个项目的下载部分实现异步httpx吗?那样子更快。

你说对,asyncio毕竟是协程应该比thread还是快一些。

CWHer commented 1 year ago

抱歉才发现您用的多线程。。。

顺便请问一下 https://www.pixiv.net/ajax/user/23945843/profile/all?lang=zh这个链接是如何确定的呢?

image
kingwingfly commented 1 year ago

I wanna use https to make the downloader faster. Compared with requests, httpx is faster due to supporting asynicio. 我可以为这个项目的下载部分实现异步httpx吗?那样子更快。

你说对,asyncio毕竟是协程应该比thread还是快一些。

啊哈哈哈,抱歉其实一开始我以为你用的单线程,因为你的多线程写法我不会,一开始没有看出来,所以才想用我熟悉的方法来实现一个多线程下载图片。。。

理解这个链接需要什么前置知识呢?有没有教程或者关键词推荐一下~~灰常感谢你!

CWHer commented 1 year ago

理解这个链接需要什么前置知识呢?有没有教程或者关键词推荐一下~~灰常感谢你!

我的理解是这是一个典型的AJAX请求,前端利用这样有固定pattern的URL向后端请求某些数据

然而我对Web不是很了解,不保证对

kingwingfly commented 1 year ago

理解这个链接需要什么前置知识呢?有没有教程或者关键词推荐一下~~灰常感谢你!

我的理解是这是一个典型的AJAX请求,前端利用这样有固定pattern的URL向后端请求某些数据

~然而我对Web不是很了解,不保证对~

所噶,thanks!