前言
上一节中python学习心得(3)— 小米应用商店APK爬取介绍了如何进行爬取APK
对应源码为
https://github.com/QyMars/APKSpider/blob/master/XiaomiCrawler.py
并发
单线程的进行下载,效率太低,为了实现并发,使用了Python中的Celery异步任务队列来实现并发
源代码
Github:https://github.com/QyMars/APKSpider/blob/master/XiaomiCrawlerWithCelery.py
添加Celery
app = Celery('XiaomiCrawlerWithCelery', broker='amqp://localhost')
添加并发方法
@app.task
def download