polish
Marco Andronaco andronacomarco@gmail.com
Tue, 22 Aug 2023 00:54:45 +0200
4 files changed,
6 insertions(+),
4 deletions(-)
M
fxyoutube/constants.py
→
fxyoutube/constants.py
@@ -1,5 +1,7 @@
MAX_SIZE_MB = 50 +YT_TTL_MINUTES = 60 * 6 DB_URL = "cache.db" + UA_REGEX = r"bot|facebook|embed|got|firefox\/92|firefox\/38|curl|wget|go-http|yahoo|generator|whatsapp|preview|link|proxy|vkshare|images|analyzer|index|crawl|spider|python|cfnetwork|node" BASE_URL = "https://www.youtube.com/watch?v=" TS_FORMAT = "%Y-%m-%d %H:%M:%S"
M
fxyoutube/db.py
→
fxyoutube/db.py
@@ -38,7 +38,7 @@ temp = result[0]
timestamp = datetime.strptime(temp[10], c.TS_FORMAT) delta = datetime.now() - timestamp - if delta > timedelta(seconds=30): + if delta > timedelta(minutes=c.YT_TTL_MINUTES): raise IndexError info = {
M
fxyoutube/templates/base.html
→
fxyoutube/templates/base.html
@@ -20,7 +20,7 @@ <meta property="og:video:type" content="video/{{ info['video_ext'] }}" />
<meta property="twitter:image" content="0" /> <meta property="og:title" content="{{ info['title'] }}" /> <meta property="og:description" content="{{ info['description'] }}" /> - <meta property="og:site_name" content="FixYouTube" /> + <meta property="og:site_name" content="FixYouTube ({{ info['uploader'] }})" /> </head> <body></body> </html>
M
fxyoutube/yt_info.py
→
fxyoutube/yt_info.py
@@ -25,7 +25,7 @@
return format def truncate_lines(input_str: str, max: int = 5): - return "\n".join(input_str.splitlines()[:5]) + return "\n".join(input_str.splitlines()[:max]) def get_info_ytdl(yt_id: str): info = ydl.extract_info(c.BASE_URL + yt_id, download=False)@@ -57,5 +57,5 @@ "height": max_format["height"],
"width": max_format["width"], "url": max_format["url"], }) - + print(max_format["url"]) return yt_info