def main():
if len(sys.argv) == 1:
if os.path.isfile('tmp_url.txt'):
with open('tmp_url.txt') as f:
url = f.read()
else:
url = input('URL: ')
else:
url = sys.argv[1]
with open('tmp_url.txt', 'w') as f:
f.write(url)
name, videos = parse_videos(url)
length = len(videos)
if not os.path.isdir(name): os.makedirs(name)
for i in range(length):
try:
download(videos, i, name, length)
except KeyboardInterrupt:
os._exit(1)
if os.path.isfile('tmp_url.txt'):
os.unlink('tmp_url.txt')
评论列表
文章目录