Update yt-dlp, add --file argument
Signed-off-by: Lev Rusanov <30170278+JDM170@users.noreply.github.com>
This commit is contained in:
@@ -13,7 +13,7 @@ from tqdm import tqdm
|
||||
|
||||
|
||||
def ascii_banner(text):
|
||||
print('\n\n########################################################\n\n\n')
|
||||
print('\n########################################################\n\n\n')
|
||||
ascii_banner = pyfiglet.figlet_format(text)
|
||||
print(ascii_banner)
|
||||
################################
|
||||
@@ -27,11 +27,11 @@ def ph_config_dl_dir(dir):
|
||||
global download_dir
|
||||
if (dir != None):
|
||||
download_dir = dir
|
||||
print("Output directory: " + download_dir + "\model\\")
|
||||
print("Output directory: " + download_dir + "\\model\\")
|
||||
if (os.path.exists(download_dir) != True):
|
||||
print('Invalid Directory!')
|
||||
sys.exit()
|
||||
download_dir = download_dir + "\model\\"
|
||||
download_dir = download_dir + "\\model\\"
|
||||
if (os.path.exists(download_dir) != True):
|
||||
os.mkdir(download_dir)
|
||||
|
||||
@@ -86,7 +86,7 @@ def download_video(url, filename):
|
||||
state = 0
|
||||
print('[+] Save as: ' + filename + '\n')
|
||||
try:
|
||||
run_command(['.\yt-dlp', '--downloader', 'aria2c', '--downloader-args',
|
||||
run_command(['.\\yt-dlp', '--downloader', 'aria2c', '--downloader-args',
|
||||
'aria2c:-x 8 --log-level=info --file-allocation=none --summary-interval=1', '--no-warnings', '--newline', '-o', filename, url])
|
||||
print("[$] Video download successfully!")
|
||||
except KeyboardInterrupt:
|
||||
@@ -129,7 +129,7 @@ def ph_download_playlist(url, model_name, limit):
|
||||
# tmp_playlist download
|
||||
print('... Getting playlist information...')
|
||||
try:
|
||||
playlist_download_command = [".\yt-dlp", "-j",
|
||||
playlist_download_command = [".\\yt-dlp", "-j",
|
||||
"--flat-playlist", "--no-check-certificate", url]
|
||||
res = subprocess.run(playlist_download_command,
|
||||
capture_output=True, text=True).stdout.split("\n")
|
||||
@@ -152,13 +152,13 @@ def ph_download_playlist(url, model_name, limit):
|
||||
# video_dict = ast.literal_eval(res[i])
|
||||
video_dict = json.loads(res[i])
|
||||
url = video_dict['url']
|
||||
p = subprocess.Popen(['.\yt-dlp', '--no-warnings', '--dump-json',
|
||||
p = subprocess.Popen(['.\\yt-dlp', '--no-warnings', '--dump-json',
|
||||
'--skip-download', url], stdout=subprocess.PIPE, stderr=None, shell=True)
|
||||
output = p.communicate()[0]
|
||||
info = json.loads(output.decode('utf-8'))
|
||||
# duration = int(info['duration'])
|
||||
filename = os.path.join(download_dir, model_name, fix_title(
|
||||
str(info["title"])) + '.' + str(info['ext']))
|
||||
filename = os.path.join(download_dir, model_name,
|
||||
fix_title(str(info["title"])) + '.' + str(info['ext']))
|
||||
print("\n\n==========================================\n[+] File #{}: {}".format(
|
||||
count, fix_title(str(info["title"])) + '.' + str(info['ext'])))
|
||||
ph_download_video(url, model_name, filename)
|
||||
@@ -172,7 +172,7 @@ def fix_url(url, type):
|
||||
url = ph_check_valid_pornhub_url(url)
|
||||
|
||||
if '/model/' not in url:
|
||||
p = subprocess.Popen(['.\yt-dlp', '--no-warnings', '--dump-json',
|
||||
p = subprocess.Popen(['.\\yt-dlp', '--no-warnings', '--dump-json',
|
||||
'--skip-download', url], stdout=subprocess.PIPE, stderr=None, shell=True)
|
||||
output = p.communicate()[0]
|
||||
info = json.loads(output.decode('utf-8'))
|
||||
@@ -195,7 +195,7 @@ def ph_get_video(url):
|
||||
# global duration
|
||||
url = ph_check_valid_pornhub_url(url)
|
||||
|
||||
p = subprocess.Popen(['.\yt-dlp', '--no-warnings', '--dump-json',
|
||||
p = subprocess.Popen(['.\\yt-dlp', '--no-warnings', '--dump-json',
|
||||
'--skip-download', url], stdout=subprocess.PIPE, stderr=None, shell=True)
|
||||
output = p.communicate()[0]
|
||||
info = json.loads(output.decode('utf-8'))
|
||||
|
||||
Reference in New Issue
Block a user