##Copy-paste one-click command: #yt-dlp --write-thumbnail --convert-thumbnails png -ciw --embed-thumbnail --add-metadata --playlist-reverse --match-filter "title ~= (?i)(ASMR|binaural|sleep|バイノーラル|おしがま|おしっこ|健康器具|お〇っこ|お〇がま|お漏らし|妹|シチュエーションボイス|企画】|асмр)" --download-archive /mnt/virt/ASMR/archive.txt -o '/mnt/virt/ASMR/%(uploader)s/%(title).200B - %(id)s.%(ext)s' https://www.youtube.com/playlist?list=UU8wF-h8ewn77jUJQqWJcnww #Instructions: #Create 3 .txt files with the following names in the same folder where you set the log path to: vt_playlists.txt video_urls.txt vt_urls.txt #You'll use those to store the actual channel URLS (one per line) #Channel URLS should be in the format https://www.youtube.com/playlist?list=UUP8TJll-FkcJ0CtvWHN7xVw where everything after /playlist?list=UU is the channel ID #Channel ID is the string following /channel/UC in the channel homepage URL and can be obtained with the following javascript injection: window.location=ytInitialData.metadata.channelMetadataRenderer.channelUrl #Set the following 3 paths as appropriate as well as add/remove filter keywords on line 22! AND DONT FORGET THE TRAILING SLASHES FOR THE FIRST TWO PATHS (not the executable though) downloadPath = "/mnt/virt/ASMR/" logPath = "/mnt/virt/ASMR_Script/" ytdlpPath = "/usr/local/bin/yt-dlp" import os, re from datetime import datetime def downloadVideo(format): #Only videos with the following keywords in their titles will be downloaded (insert fetishes here) ytFilter = "\"title ~= (?i)(ASMR|binaural|sleep|バイノーラル|おしがま|おしっこ|健康器具|お〇っこ|お〇がま|お●がま|お漏らし|妹|シチュエーションボイス|企画】|асмр)\"" #Handles playlist downloads i.e. downloading specific or all playlists from channel(s) (defaults to audio_only also) if format == 1: tempTxt = logPath + "vt_playlists.txt" txtList = open(tempTxt, "r") #.200B limits filename to 200 bytes, preventing write errors while still maintaining the full video title as an internal value output = downloadPath + "\'%(uploader)s/%(playlist)s/%(title).200B - %(id)s.%(ext)s\' " ytFormat = " -f 140 " #Handles native resolution full video downloads (for your favorites that you want videos for rather than audio-only) elif format == 2: tempTxt = logPath + "video_urls.txt" txtList = open(tempTxt, "r") output = downloadPath + "\'%(uploader)s/%(title).200B - %(id)s.%(ext)s\' " ytFormat = " --embed-subs --write-subs --sub-langs en.us --sub-format srt --write-thumbnail --convert-thumbnails png " #Handles .m4a only downloads else: tempTxt = logPath + "vt_urls.txt" txtList = open(tempTxt, "r") output = downloadPath + "\'%(uploader)s/%(title).200B - %(id)s.%(ext)s\' " ytFormat = " -f 140 " #formats URLS from txt by adding them to a list and stripping newlines urls = [] for i in txtList: i = i.rstrip('\n') urls.append(i) #Iterates over all URLS provided by the txt files, running yt-dlp for each and downloading all videos that match the filter and aren't present in the generated archive txt for url in urls: cmd = ytdlpPath + ytFormat + "-ciw --embed-thumbnail --add-metadata --playlist-reverse --match-filter " + ytFilter + " --download-archive " + downloadPath + "archive.txt -o " + output + url os.system(cmd + ">>" + logPath + "vt_script_log.txt 2>&1") txtList.close() tempLog = logPath + "vt_script_log.txt" vtLog = open(tempLog, "w+") downloadVideo(0) downloadVideo(1) downloadVideo(2) #Pipes all output to a txt file, appending downloaded videos to the end and counting them vtLog.write("\nNew ASMR files downloaded today:\n") vtLines = vtLog.readlines() matches = [] for i in vtLines: if re.search(r"(\[download\] Destination).*", i): vtLog.write(i) matches.append(i) currentDate = datetime.today().strftime('%Y-%m-%d') vtLog.write("\nNumber of new ASMR files downloaded today: " + str(len(matches))) vtLog.close() newLog = logPath + "vt_script_log" + "_" + currentDate + ".txt" os.rename(tempLog, newLog)