aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesus E <heckyel@riseup.net>2023-06-18 19:45:34 -0400
committerJesus E <heckyel@riseup.net>2023-06-18 19:45:34 -0400
commitcd7624f2cb94ba3c8776b769f294b8a9ad8d7487 (patch)
treec77f6ff8825aa38f96124936c1f910eb6825da78
parent5d5322587414dcc12572a6e854fbfe072b7e63b6 (diff)
downloadyt-local-cd7624f2cb94ba3c8776b769f294b8a9ad8d7487.tar.lz
yt-local-cd7624f2cb94ba3c8776b769f294b8a9ad8d7487.tar.xz
yt-local-cd7624f2cb94ba3c8776b769f294b8a9ad8d7487.zip
Set hqdefault thumnail images
-rw-r--r--youtube/comments.py2
-rw-r--r--youtube/playlist.py2
-rw-r--r--youtube/subscriptions.py2
-rw-r--r--youtube/util.py4
-rw-r--r--youtube/yt_data_extract/everything_else.py2
5 files changed, 6 insertions, 6 deletions
diff --git a/youtube/comments.py b/youtube/comments.py
index 127db01..5825d20 100644
--- a/youtube/comments.py
+++ b/youtube/comments.py
@@ -150,7 +150,7 @@ def post_process_comments_info(comments_info):
util.URL_ORIGIN, '/watch?v=', comments_info['video_id'])
comments_info['video_thumbnail'] = concat_or_none(
settings.img_prefix, 'https://i.ytimg.com/vi/',
- comments_info['video_id'], '/mqdefault.jpg'
+ comments_info['video_id'], '/hqdefault.jpg'
)
diff --git a/youtube/playlist.py b/youtube/playlist.py
index 357a7ec..f4096dc 100644
--- a/youtube/playlist.py
+++ b/youtube/playlist.py
@@ -104,7 +104,7 @@ def get_playlist_page():
util.prefix_urls(item)
util.add_extra_html_info(item)
if 'id' in item:
- item['thumbnail'] = settings.img_prefix + 'https://i.ytimg.com/vi/' + item['id'] + '/default.jpg'
+ item['thumbnail'] = f"{settings.img_prefix}https://i.ytimg.com/vi/{item['id']}/hqdefault.jpg"
item['url'] += '&list=' + playlist_id
if item['index']:
diff --git a/youtube/subscriptions.py b/youtube/subscriptions.py
index aa6101d..242510b 100644
--- a/youtube/subscriptions.py
+++ b/youtube/subscriptions.py
@@ -1018,7 +1018,7 @@ def serve_subscription_thumbnail(thumbnail):
f.close()
return flask.Response(image, mimetype='image/jpeg')
- url = "https://i.ytimg.com/vi/" + video_id + "/mqdefault.jpg"
+ url = f"https://i.ytimg.com/vi/{video_id}/hqdefault.jpg"
try:
image = util.fetch_url(url, report_text="Saved thumbnail: " + video_id)
except urllib.error.HTTPError as e:
diff --git a/youtube/util.py b/youtube/util.py
index 6ee9fcd..5e4af55 100644
--- a/youtube/util.py
+++ b/youtube/util.py
@@ -462,7 +462,7 @@ class RateLimitedQueue(gevent.queue.Queue):
def download_thumbnail(save_directory, video_id):
- url = "https://i.ytimg.com/vi/" + video_id + "/mqdefault.jpg"
+ url = f"https://i.ytimg.com/vi/{video_id}/hqdefault.jpg"
save_location = os.path.join(save_directory, video_id + ".jpg")
try:
thumbnail = fetch_url(url, report_text="Saved thumbnail: " + video_id)
@@ -504,7 +504,7 @@ def video_id(url):
# default, sddefault, mqdefault, hqdefault, hq720
def get_thumbnail_url(video_id):
- return settings.img_prefix + "https://i.ytimg.com/vi/" + video_id + "/mqdefault.jpg"
+ return f"{settings.img_prefix}https://i.ytimg.com/vi/{video_id}/hqdefault.jpg"
def seconds_to_timestamp(seconds):
diff --git a/youtube/yt_data_extract/everything_else.py b/youtube/yt_data_extract/everything_else.py
index 745d08f..281bc03 100644
--- a/youtube/yt_data_extract/everything_else.py
+++ b/youtube/yt_data_extract/everything_else.py
@@ -168,7 +168,7 @@ def extract_playlist_metadata(polymer_json):
if metadata['first_video_id'] is None:
metadata['thumbnail'] = None
else:
- metadata['thumbnail'] = 'https://i.ytimg.com/vi/' + metadata['first_video_id'] + '/mqdefault.jpg'
+ metadata['thumbnail'] = f"https://i.ytimg.com/vi/{metadata['first_video_id']}/hqdefault.jpg"
metadata['video_count'] = extract_int(header.get('numVideosText'))
metadata['description'] = extract_str(header.get('descriptionText'), default='')