diff --git a/app/routes.py b/app/routes.py index 1d37866..e8de468 100644 --- a/app/routes.py +++ b/app/routes.py @@ -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", "

").replace("\n", "
") + 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 @@ -636,7 +647,7 @@ def getYoutubePosts(ids): if time.days >= 15: continue - + video = ytPost() video.date = vid.published_parsed video.timeStamp = getTimeDiff(vid.published_parsed) diff --git a/app/templates/_empty_feed.html b/app/templates/_empty_feed.html index fef5e9c..365eb0e 100644 --- a/app/templates/_empty_feed.html +++ b/app/templates/_empty_feed.html @@ -1,6 +1,6 @@ -
+
- +
diff --git a/app/templates/ytfollowing.html b/app/templates/ytfollowing.html index 858dafb..6c8becd 100644 --- a/app/templates/ytfollowing.html +++ b/app/templates/ytfollowing.html @@ -12,25 +12,24 @@
-
-
- {% for channel in channelList %} -
-
-

-

- {{ form.hidden_tag() }} - {{ form.submit(value='Unfollow') }} -
-

-
- - +
+
+ {% for channel in channelList %} +
+
+

+

+ {{ form.hidden_tag() }} + {{ form.submit(value='Unfollow') }} +
+

+
+ +
+ {% endfor %}
- {% endfor %} -
{% endblock %} \ No newline at end of file diff --git a/app/templates/ytsearch.html b/app/templates/ytsearch.html index 1221a32..cbf723c 100644 --- a/app/templates/ytsearch.html +++ b/app/templates/ytsearch.html @@ -14,8 +14,8 @@

{{ form.submit() }}

-

Users

- {% if channels %} + {% if channels %} +

Users

{% for res in channels %} @@ -51,8 +51,8 @@
-

Videos

{% if videos %} +

Videos

{% for video in videos %} {% include '_video_item.html' %}