Wyświetlenie listy dostępnych formatów
yt-dlp -F URL_FILMU
Pobieranie filmu
yt-dlp URL_FILMU
Pobieranie określonego formatu. Przy czym 231 to format video a 234 format audio.
yt-dlp -f "231+234" -o "%(title)s.%(ext)s" https://www.youtube.com/watch?v=-MrS4SDzxMk
yt-dlp -x --audio-format mp3 https://www.youtube.com/playlist?list=PLgcyejo8w-DNnDrt6kcFGuiiZBlmnz9LK
import os import re import unicodedata def sanitize_filename(filename): name, ext = os.path.splitext(filename) nfkd_form = unicodedata.normalize('NFKD', name) ascii_name = nfkd_form.encode('ASCII', 'ignore').decode('ASCII') cleaned = re.sub(r'[^A-Za-z0-9 _\.\-\[\]]', '', ascii_name) cleaned = re.sub(r'\s+', ' ', cleaned).strip() return f"{cleaned}{ext}" # Przetwórz wszystkie pliki .mp3 w bieżącym katalogu for filename in os.listdir(): if filename.lower().endswith(".mp3"): new_name = sanitize_filename(filename) if new_name != filename: print(f"Zmieniam: {filename} -> {new_name}") os.rename(filename, new_name)