引自
https://github.com/geekcomputers/Python/blob/master/youtube-downloader%20fast.py
直接参考
# -*- coding: utf-8 -*-
import os
import sys
import subprocess
def fast_youtube_downloader(video_link, threads):
""" Downloads YouTube videos quickly with parallel threads using aria2c """
subprocess.call(['youtube-dl',
video_link,
'--external-downloader', # 调用外部下载工具
'aria2c',
'--external-downloader-args', # 调用外部下载工具参数
'-x' + threads]) # 启用aria2 多个线程,最多启用16个
def main(video_link, threads):
""" main func """
fast_youtube_downloader(video_link, threads)
if __name__ == '__main__':
main(sys.argv[1], sys.argv[2])
注释
: youtube-dl 是一种下载工具,不单单可以国外youtube,同样可以下载国内视频如爱奇艺等。
网友评论