麻烦大家帮忙看下为什么多进程中的函数未执行
import requests import re from multiprocessing import Pool def download(ts_url,index): ts_content = requests.get(url=ts_url, headers=headers).content with open(dirs + '\\' + index + '.mp4', "wb") as f: f.write(ts_content) def fun_ts(url): response = requests.get(url=url, headers=headers) html_m3u8 = re.findall('source src="(.*?)"', response.text)[0] m3u8_data = requests.get(url=html_m3u8, headers=headers).text ts = re.sub('#E.*', '', m3u8_data).split() return ts if __name__ == "__main__": headers = { 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36' } dirs = dirs = 'F:\py_downloads\661131' url = 'https://hsex.icu/video-661131.htm' ts = fun_ts(url) pool = Pool(10) for index in ts: ts_url = f'https://cdn.bigcloud.bond/hls/661131/{index}' pool.apply_async(download,(ts_url,index)) pool.close() pool.join()