This commit is contained in:
pluja 2020-09-26 14:07:37 +02:00
parent 33e4c5404b
commit 1c02914b90
2 changed files with 19 additions and 1 deletions

View File

@ -297,6 +297,20 @@ def channel(id):
data = feedparser.parse(data.content) data = feedparser.parse(data.content)
channelData = YoutubeSearch.channelInfo(id) 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) 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']) @app.route('/watch', methods=['GET'])

View File

@ -4,7 +4,11 @@
<div class="blue ui centered card"> <div class="blue ui centered card">
<div class="content"> <div class="content">
<div class="center aligned author"> <div class="center aligned author">
<img alt="Avatar" class="ui avatar image" src="/img/{{channel.avatar.replace('/', '~')}}"> {%if config.nginxVideoStream%}
<img alt="Thumbnail" src="{{channel.avatar}}">
{%else%}
<img alt="Thumbnail" src="/img/{{channel.avatar.replace('/', '~')}}">
{%endif%}
</div> </div>
<div class="center aligned header"><a href="">{{channel.name}}</a></div> <div class="center aligned header"><a href="">{{channel.name}}</a></div>
<div class="center aligned description"> <div class="center aligned description">