Youtube: Format video descriptions
This commit is contained in:
parent
0f4d6e163e
commit
54f3fc2ca6
@ -18,6 +18,7 @@ import random, string
|
||||
import time, datetime
|
||||
import feedparser
|
||||
import requests
|
||||
import bleach
|
||||
import urllib
|
||||
import json
|
||||
import re
|
||||
@ -312,7 +313,7 @@ def watch():
|
||||
|
||||
video = {
|
||||
'title':data['title'],
|
||||
'description':Markup(data['description']),
|
||||
'description':Markup(markupString(data['description'])),
|
||||
'viewCount':data['view_count'],
|
||||
'author':data['uploader'],
|
||||
'authorUrl':data['uploader_url'],
|
||||
@ -320,8 +321,18 @@ def watch():
|
||||
'id':id,
|
||||
'averageRating': str((float(data['average_rating'])/5)*100)
|
||||
}
|
||||
print(video['description'])
|
||||
return render_template("video.html", video=video)
|
||||
|
||||
def markupString(string):
|
||||
string = string.replace("\n\n", "<br><br>").replace("\n", "<br>")
|
||||
string = bleach.linkify(string)
|
||||
string = string.replace("https://youtube.com/", "")
|
||||
string = string.replace("https://www.youtube.com/", "")
|
||||
string = string.replace("https://twitter.com/", "/u/")
|
||||
print(request.url)
|
||||
return string
|
||||
|
||||
## PROXY videos through Parasitter server to the client.
|
||||
@app.route('/stream', methods=['GET', 'POST'])
|
||||
@login_required
|
||||
|
@ -1,6 +1,6 @@
|
||||
<div class="ui text container">
|
||||
<div class="ui center aligned text container">
|
||||
<div class="ui row">
|
||||
<img class="ui medium circular image" src="{{ url_for('static',filename='img/empty.png') }}">
|
||||
<img class="ui image" src="{{ url_for('static',filename='img/empty.png') }}">
|
||||
</div>
|
||||
|
||||
<div class="ui row">
|
||||
|
@ -12,8 +12,8 @@
|
||||
</div></a>
|
||||
</div>
|
||||
|
||||
<div style="margin: 0em;" class="ui one column centered grid">
|
||||
<div class="ui middle aligned divided list">
|
||||
<div class="ui text container">
|
||||
<div class="ui relaxed divided list">
|
||||
{% for channel in channelList %}
|
||||
<div class="item">
|
||||
<div class="right floated content">
|
||||
@ -24,9 +24,8 @@
|
||||
</form>
|
||||
</p>
|
||||
</div>
|
||||
<img class="ui avatar image" src="{{ url_for('static',filename='img/avatars/')}}{{range(1, 12) | random}}.png">
|
||||
<div class="content">
|
||||
<a href="{{ url_for('channel', id=channel.channelId)}}">{{channel.channelName}}</a>
|
||||
<a href="{{ url_for('channel',id=channel.channelId)}}" class="header">{{channel.channelName}}</a>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
@ -14,8 +14,8 @@
|
||||
<p>{{ form.submit() }}</p>
|
||||
</form>
|
||||
|
||||
<h3 class="ui dividing header">Users</h3>
|
||||
{% if channels %}
|
||||
<h3 class="ui dividing header">Users</h3>
|
||||
<div class="ui relaxed divided list">
|
||||
|
||||
{% for res in channels %}
|
||||
@ -51,8 +51,8 @@
|
||||
|
||||
|
||||
<div class="ui middle aligned divided list">
|
||||
<h3 class="ui dividing header">Videos</h3>
|
||||
{% if videos %}
|
||||
<h3 class="ui dividing header">Videos</h3>
|
||||
<div class="ui centered cards">
|
||||
{% for video in videos %}
|
||||
{% include '_video_item.html' %}
|
||||
|
Reference in New Issue
Block a user