aboutsummaryrefslogtreecommitdiffstats
path: root/youtube/util.py
diff options
context:
space:
mode:
Diffstat (limited to 'youtube/util.py')
-rw-r--r--youtube/util.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/youtube/util.py b/youtube/util.py
index 3c32ddb..a75a7b5 100644
--- a/youtube/util.py
+++ b/youtube/util.py
@@ -342,8 +342,8 @@ def video_id(url):
# default, sddefault, mqdefault, hqdefault, hq720
def get_thumbnail_url(video_id):
- return "/i.ytimg.com/vi/" + video_id + "/mqdefault.jpg"
-
+ return f"{settings.img_prefix}https://i.ytimg.com/vi/" + video_id + "/mqdefault.jpg"
+
def seconds_to_timestamp(seconds):
seconds = int(seconds)
hours, seconds = divmod(seconds,3600)
@@ -394,10 +394,11 @@ def concat_or_none(*strings):
def prefix_urls(item):
- try:
- item['thumbnail'] = prefix_url(item['thumbnail'])
- except KeyError:
- pass
+ if settings.proxy_images:
+ try:
+ item['thumbnail'] = prefix_url(item['thumbnail'])
+ except KeyError:
+ pass
try:
item['author_url'] = prefix_url(item['author_url'])