python更新版本多线程下载音乐

本文介绍如何使用Python的多线程库下载音乐文件,提高下载效率。通过创建线程池,对音乐链接进行并发处理,实现了快速批量下载。
摘要由CSDN通过智能技术生成
'''
Description:
Author: pdh
Date: 2020-11-05 12:12:22
LastEditors: pdh
LastEditTime: 2020-11-06 14:47:55
FilePath: \down\down.py
'''
# coding=utf-8

import os
import requests
from concurrent.futures import ThreadPoolExecutor
import threading
import asyncio

gLock = threading.Lock()
gPool = ThreadPoolExecutor(50)


def pinfo(text):
    global gLock
    gLock.acquire()
    print(text)
    gLock.release()


async def downOne(name, loop):
    urlPrefixArr = (
        "http://mp3f.xxx:9090",
        "http://mp3-d.txxxxcom:9090",
        "http://mp32a.xxxcom:9090",
        "http://mp33a.tixxx.com:9090",
        "http://mp3-2e.txcom:9090",
        "http://mp3-e.txxcom:9090",
        "http://mp3-2f.tixxcom:9090",
        "http://mp32b.tinxxcom:9090",
        "http://mp33b.tixxcom:9090",
        "http://mp3-f.xxxxcom:9090",
        "http
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值