Youtube-Archiver/download-videos.py

32 lines
969 B
Python
Raw Normal View History

2022-03-23 20:53:43 +01:00
#!/bin/python
import yaml
import os
with open("linklist-videos.yaml", "r") as yamlfile:
try:
config = yaml.safe_load(yamlfile)
for entry in config:
print(f"\033[92mGrabbing '{entry['url']}':\033[0m")
folderName = entry["folder-name"] if "folder-name" in entry else "%(uploader)s"
os.system(f"""
yt-dlp
-c
--no-call-home
2022-03-23 20:53:43 +01:00
--merge-output-format mkv
-o 'videos/{folderName}/%(title)s.%(ext)s'
--extractor-args youtube:player_client=android
--throttled-rate 100M
--restrict-filenames
--download-archive alreadydownloaded-videos.txt
--match-filter "duration < 36000 & is_live = false"
2022-03-23 20:53:43 +01:00
'{entry['url']}'
""".replace('\n', " ")
)
except yaml.YAMLError as exc:
print("You fucked up the yaml format.")