Update download.py
This commit is contained in:
parent
082576061e
commit
ad24e0827e
@ -1,6 +1,15 @@
|
|||||||
from fastapi.responses import JSONResponse
|
from fastapi.responses import JSONResponse
|
||||||
import os, yt_dlp, json, requests
|
import os, yt_dlp, json, requests
|
||||||
from bs4 import BeautifulSoup
|
from bs4 import BeautifulSoup
|
||||||
|
import re
|
||||||
|
|
||||||
|
# Define your patterns
|
||||||
|
reject_patterns = [
|
||||||
|
re.compile(r'(?i).*behind.?the.?scenes.*'),
|
||||||
|
re.compile(r'(?i).*trailer.*'),
|
||||||
|
re.compile(r'(?i).*recap.*'),
|
||||||
|
re.compile(r'(?i).*last.looks.*'),
|
||||||
|
]
|
||||||
|
|
||||||
class grab():
|
class grab():
|
||||||
def season(url):
|
def season(url):
|
||||||
@ -57,12 +66,13 @@ class dropout():
|
|||||||
'home': directory
|
'home': directory
|
||||||
},
|
},
|
||||||
'cookiefile': '/data/dropout.cookies.txt',
|
'cookiefile': '/data/dropout.cookies.txt',
|
||||||
'reject_title': [
|
'match_filter': yt_dlp.utils.match_filter_func("title !~= '(?i).*behind.?the.?scenes.*|.*trailer.*|.*recap.*|.*last.looks.*'"),
|
||||||
r'(?i).*behind.?the.?scenes.*', # Reject titles with "behind the scenes" (case-insensitive)
|
# 'reject_title': [
|
||||||
r'(?i).*trailer.*', # Reject titles with "trailer" (case-insensitive)
|
# r'(?i).*behind.?the.?scenes.*', # Reject titles with "behind the scenes" (case-insensitive)
|
||||||
r'(?i).*recap.*', # Reject titles with "recap" (case-insensitive)
|
# r'(?i).*trailer.*', # Reject titles with "trailer" (case-insensitive)
|
||||||
r'(?i).*last.looks.*' # Reject titles with "last looks" (case-insensitive)
|
# r'(?i).*recap.*', # Reject titles with "recap" (case-insensitive)
|
||||||
],
|
# r'(?i).*last.looks.*' # Reject titles with "last looks" (case-insensitive)
|
||||||
|
# ],
|
||||||
'outtmpl': show + ' - S'+f"{int(season):02}"+'E'+episode+' - %(title)s.%(ext)s',
|
'outtmpl': show + ' - S'+f"{int(season):02}"+'E'+episode+' - %(title)s.%(ext)s',
|
||||||
'noplaylist': True,
|
'noplaylist': True,
|
||||||
# Additional options for downloading subtitles
|
# Additional options for downloading subtitles
|
||||||
@ -71,6 +81,25 @@ class dropout():
|
|||||||
}
|
}
|
||||||
with yt_dlp.YoutubeDL(dl_ops) as ydl:
|
with yt_dlp.YoutubeDL(dl_ops) as ydl:
|
||||||
ydl.download([url])
|
ydl.download([url])
|
||||||
|
# ydl_opts = {
|
||||||
|
# 'quiet': True, # Turn off download progress messages
|
||||||
|
# 'skip_download': True, # Don't download anything
|
||||||
|
# 'cookiefile': '/data/dropout.cookies.txt',
|
||||||
|
# }
|
||||||
|
|
||||||
|
# with yt_dlp.YoutubeDL(ydl_opts) as ydl:
|
||||||
|
# info = ydl.extract_info(url, download=False)
|
||||||
|
|
||||||
|
# print(f"Playlist Title: {info.get('title')}")
|
||||||
|
# print(f"Uploader: {info.get('uploader')}")
|
||||||
|
# print(f"Number of videos: {len(info.get('entries', []))}")
|
||||||
|
# print()
|
||||||
|
|
||||||
|
# for i, entry in enumerate(info['entries'], 1):
|
||||||
|
# print(f"{i}. {entry.get('title')}")
|
||||||
|
# print(f" URL: {entry.get('webpage_url')}")
|
||||||
|
# print(f" Duration: {entry.get('duration')} seconds")
|
||||||
|
# print()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user