Fixes #81 on ytsearch

This commit is contained in:
pluja 2020-09-26 20:37:44 +02:00
parent 2dbc62c6ff
commit 641724f79f
2 changed files with 11 additions and 1 deletions

View File

@ -234,6 +234,12 @@ def ytsearch():
sort = 0
filters = {"time":0, "type":0, "duration":0}
results = yts.search_by_terms(searchTerms, page, autocorrect, sort, filters)
for channel in results['channels']:
if config['nginxVideoStream']:
channel['thumbnail'] = channel['thumbnail'].replace("~", "/")
hostName = urllib.parse.urlparse(channel['thumbnail']).netloc
channel['thumbnail'] = channel['thumbnail'].replace("https://{}".format(hostName), "")+"&host="+hostName
print(channel['thumbnail'])
return render_template('ytsearch.html', form=form, btform=button_form, results=results, restricted=config['restrictPublicUsage'], config=config)
else:

View File

@ -21,7 +21,11 @@
{% for res in results.channels %}
<div class="item">
<div class="image">
<img src="{{ url_for('img', url=res.thumbnail) }}">
{% if config.nginxVideoStream %}
<img src="{{res.thumbnail}}" alt="Avatar">
{% else %}
<img alt="Avatar" src="{{ url_for('img', url=res.thumbnail) }}">
{% endif %}
</div>
<div class="content">
<a class = "header" href="{{ url_for('channel', id=res.channelId)}}">{{res.username}}</a>