Add /channel/<id> route and build header

This commit is contained in:
pluja 2020-08-23 10:20:33 +02:00
parent 7c78ab8d96
commit 93f71a8ea8
2 changed files with 46 additions and 0 deletions

View File

@ -285,6 +285,16 @@ def ytunfollow(channelId):
flash("There was an error unfollowing the user. Try again.")
return redirect(url_for('ytsearch'))
@app.route('/channel/<id>', methods=['GET'])
@login_required
def channel(id):
data = requests.get('https://www.youtube.com/feeds/videos.xml?channel_id={id}'.format(id=id))
data = feedparser.parse(data.content)
channel = YoutubeSearch.channelInfo(id)
return render_template('channel.html', channel=channel)
@app.route('/watch', methods=['GET'])
@login_required
def watch():

View File

@ -0,0 +1,36 @@
{% extends "base.html" %}
{% block content %}
<div class="blue ui centered card">
<div class="content">
<div class="center aligned author">
<img class="ui avatar image" src="{{channel.avatar}}">
</div>
<div style="margin: .1em" class="center aligned header"><a href="">{{channel.name}}</a></div>
<div class="center aligned description">
<a>
<i class="users icon"></i>
{{channel.subCount}}
</a>
</div>
</div>
<div class="extra content">
</div>
</div>
</div>
<div class="ui one column grid" id="card-container">
<!--{% if not posts %}
{% include '_empty_feed.html' %}
{% else %}
{% for post in posts %}
{% if post.isRT %}
{% include '_post.html' %}
{% else %}
{% include '_post_nort.html' %}
{% endif %}
{% endfor %}
{% endif %}-->
</div>
{% endblock %}