B站多线程爬虫,简单好用

import os
import threadpool
 
'''
bilibili 视频批量多线程下载
'''
def download(i):
    try:
        print('正在多线程下载:',i)
        os.system(r"you-get https://www.bilibili.com/video/BV1ps411F7T7?p=" + str(i))
    except:
        print('error ' + str(i))
 
name_list = [x for x in range(0,21)]
# name_list = [84,88,90]
print(name_list)
pool = threadpool.ThreadPool(3)
requests = threadpool.makeRequests(download, name_list)
[pool.putRequest(req) for req in requests]
pool.wait()
print('下载结束')