Open AlexRaycan opened 1 year ago
???
The links, youtube and vimeo, are all inside the embed.txt, you can make a python script to crawl over all the links and download the videos after the fact.
That's what I've done, works like a charm. Here's the script I'm using to download all the vimeo videos. For youtube it only needs minor modifications
import os
import re
import subprocess
def search_dir(directory):
for dirpath, dirname, filenames in os.walk(directory):
if 'embed.txt' in filenames:
with open(os.path.join(dirpath, 'embed.txt')) as file:
content = file.read()
# regular expression to match vimeo URLs
url = re.search(r'https?:\/\/(?:www\.)?vimeo\.com\/\d+\/\w+', content)
if url:
download_video(url.group(), dirpath)
def download_video(url, download_dir):
print(f'Downloading video from {url} in {download_dir}')
try:
output = os.path.join(download_dir, '%(title)s')
quality = 'bestvideo[height<=720][ext=mp4]+bestaudio[ext=m4a]/best[height<=720][ext=mp4]'
subprocess.run(['yt-dlp', '-o', output, '-f', quality, url])
except Exception as e:
print(f'Error occurred when trying to download the video: {str(e)}')
# dir=os.getcwd()
dir='/Users/xxx/Downloads/_PATREON_DOWNLOADER/xxx.collections'
search_dir(dir)
The links, youtube and vimeo, are all inside the embed.txt, you can make a python script to crawl over all the links and download the videos after the fact.
That's what I've done, works like a charm. Here's the script I'm using to download all the vimeo videos. For youtube it only needs minor modifications
import os import re import subprocess def search_dir(directory): for dirpath, dirname, filenames in os.walk(directory): if 'embed.txt' in filenames: with open(os.path.join(dirpath, 'embed.txt')) as file: content = file.read() # regular expression to match vimeo URLs url = re.search(r'https?:\/\/(?:www\.)?vimeo\.com\/\d+\/\w+', content) if url: download_video(url.group(), dirpath) def download_video(url, download_dir): print(f'Downloading video from {url} in {download_dir}') try: output = os.path.join(download_dir, '%(title)s') quality = 'bestvideo[height<=720][ext=mp4]+bestaudio[ext=m4a]/best[height<=720][ext=mp4]' subprocess.run(['yt-dlp', '-o', output, '-f', quality, url]) except Exception as e: print(f'Error occurred when trying to download the video: {str(e)}') # dir=os.getcwd() dir='/Users/xxx/Downloads/_PATREON_DOWNLOADER/xxx.collections' search_dir(dir)
Where do I put this into
Doesn't matter where you put the script. Just update the path to the correct absolute path where your folders containing embed.txt are. Then run it with python. Make sure you install yt-dlp first. Should work well on Mac and Linux. On windows you'd have to modify the yt-dlp command I guess.
Hi! May be storage as .txt file with link to these videos instead as strange name files? For example file
media-{id}.txt
and collect into it direct links to videos. and people could use this links to download them themselves or using some utils to download)