首页 > 编程语言 > 详细

you-get 多线程下载网站视频

时间:2020-09-16 16:01:13      阅读:200      评论:0      收藏:0      [点我收藏+]
#!/usr/bin/python3

import threading
import time

exitFlag = 0
import subprocess

class myThread (threading.Thread):
def __init__(self, threadID, name):
threading.Thread.__init__(self)
self.threadID = threadID
self.name = name
self.counter = threadID
self.i= threadID
def run(self):
print ("开始线程:" + self.name)
print_time(self.name, self.counter, 5)
url = " https://www.bilibili.com/video/BV1WJ411k7L3?p={}".format(self.i)
command = ‘you-get -o F:\\Tcai ‘ + url
print(command)
subprocess.call(command, shell=True)
print ("退出线程:" + self.name)

def print_time(threadName, delay, counter):
while counter:
if exitFlag:
threadName.exit()
time.sleep(delay)
print ("%s: %s" % (threadName, time.ctime(time.time())))
counter -= 1
threads = []
for i in range(1,259):
thread = myThread(i, "Thread-{}".format(i))
thread.start()
threads.append(thread)

for th in threads:
th.jion()
print ("退出主线程")

you-get 多线程下载网站视频

原文:https://www.cnblogs.com/kpwong/p/13679176.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!