From 1c02914b90ab1b2ded73fd53d38b9d3faf3d0091 Mon Sep 17 00:00:00 2001 From: pluja Date: Sat, 26 Sep 2020 14:07:37 +0200 Subject: [PATCH] Solves #81 --- app/routes.py | 14 ++++++++++++++ app/templates/channel.html | 6 +++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/app/routes.py b/app/routes.py index 726fa2c..b9791ad 100644 --- a/app/routes.py +++ b/app/routes.py @@ -297,6 +297,20 @@ def channel(id): data = feedparser.parse(data.content) channelData = YoutubeSearch.channelInfo(id) + + for video in channelData[1]: + print(video) + if config['nginxVideoStream']: + hostName = urllib.parse.urlparse(video['videoThumb']).netloc + video['videoThumb'] = video['videoThumb'].replace("https://{}".format(hostName), "").replace("hqdefault", "mqdefault")+"?host="+hostName + else: + video['videoThumb'] = video['videoThumb'].replace('/', '~') + if config['nginxVideoStream']: + hostName = urllib.parse.urlparse(channelData[0]['avatar']).netloc + channelData[0]['avatar'] = channelData[0]['avatar'].replace("https://{}".format(hostName), "")+"?host="+hostName + else: + channelData[0]['avatar'] = channelData[0]['avatar'].replace('/', '~') + return render_template('channel.html', form=form, btform=button_form, channel=channelData[0], videos=channelData[1], restricted=config['restrictPublicUsage'], config=config) @app.route('/watch', methods=['GET']) diff --git a/app/templates/channel.html b/app/templates/channel.html index 85f4bee..a9c3272 100644 --- a/app/templates/channel.html +++ b/app/templates/channel.html @@ -4,7 +4,11 @@
- Avatar + {%if config.nginxVideoStream%} + Thumbnail + {%else%} + Thumbnail + {%endif%}