diff options
author | zrose584 <57181548+zrose584@users.noreply.github.com> | 2020-10-07 19:28:52 +0200 |
---|---|---|
committer | zrose584 <57181548+zrose584@users.noreply.github.com> | 2020-10-07 19:28:52 +0200 |
commit | f8d9be2d5a947a2adde12d187a52b18b7218c541 (patch) | |
tree | e0c2943b1de9f400acdbd25db2492c3673d88733 /youtube/util.py | |
parent | 9123d9a6cfa2af511b17591541ab2e67aa83475f (diff) | |
download | yt-local-f8d9be2d5a947a2adde12d187a52b18b7218c541.tar.lz yt-local-f8d9be2d5a947a2adde12d187a52b18b7218c541.tar.xz yt-local-f8d9be2d5a947a2adde12d187a52b18b7218c541.zip |
settings.py: add 'proxy_images'
Diffstat (limited to 'youtube/util.py')
-rw-r--r-- | youtube/util.py | 13 |
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']) |