Switched to more elaborate python scripts and yaml lists. Specific directory names for can now be specified for downloads.

This commit is contained in:
Leonetienne 2022-02-26 14:24:22 +01:00
parent 9b6e9fc7a6
commit b490164429
5 changed files with 67 additions and 4 deletions

4
.gitignore vendored
View File

@ -1,5 +1,5 @@
/music/ /music/
/videos/ /videos/
/linklist-*.txt /linklist-*
/alreadydownloaded*.txt /alreadydownloaded*.txt
/once.yaml /once.yaml

31
download-music.py Normal file
View File

@ -0,0 +1,31 @@
import yaml
import os
with open("linklist-music.yaml", "r") as yamlfile:
try:
config = yaml.safe_load(yamlfile)
for entry in config:
print(f"\033[92mGrabbing '{entry['url']}':")
folderName = entry["folder-name"] if "folder-name" in entry else "/\%(uploader)s"
os.system(f"""
yt-dlp
-c
--extract-audio
--audio-format mp3
--merge-output-format mkv
-o 'music/{folderName}/%(title)s.%(ext)s'
--extractor-args youtube:player_client=android
--throttled-rate 100M
--restrict-filenames
--download-archive alreadydownloaded-music.txt
'{entry['url']}'
""".replace('\n', " ")
)
except yaml.YAMLError as exc:
print("You fucked up the yaml format.")

29
download-videos.py Normal file
View File

@ -0,0 +1,29 @@
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']}':")
folderName = entry["folder-name"] if "folder-name" in entry else "\%(uploader)s"
os.system(f"""
yt-dlp
-c
--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
'{entry['url']}'
""".replace('\n', " ")
)
except yaml.YAMLError as exc:
print("You fucked up the yaml format.")

View File

@ -1,2 +1,2 @@
./download-videos.sh python3 ./download-videos.py
./download-music.sh python3 ./download-music.py

3
sync-to-nas.bat Normal file
View File

@ -0,0 +1,3 @@
robocopy music\ Y:\Leon\Mediafarm\Youtube-Archive\music\ /e /z /j /xo /move
robocopy videos\ Y:\Leon\Mediafarm\Youtube-Archive\videos\ /e /z /j /xo /move
robocopy alreadydownloaded*.txt Y:\Leon\Mediafarm\Youtube-Archive\ /z