Fix #18: Proxy images through Yotter
This commit is contained in:
parent
6f0c62aa78
commit
6865455e7c
@ -372,6 +372,13 @@ def login():
|
|||||||
return redirect(next_page)
|
return redirect(next_page)
|
||||||
return render_template('login.html', title='Sign In', form=form)
|
return render_template('login.html', title='Sign In', form=form)
|
||||||
|
|
||||||
|
#Proxy images through server
|
||||||
|
@app.route('/img/<url>', methods=['GET', 'POST'])
|
||||||
|
@login_required
|
||||||
|
def img(url):
|
||||||
|
pic = requests.get(url.replace("~", "/"))
|
||||||
|
return Response(pic,mimetype="image/png")
|
||||||
|
|
||||||
@app.route('/logout')
|
@app.route('/logout')
|
||||||
def logout():
|
def logout():
|
||||||
logout_user()
|
logout_user()
|
||||||
@ -553,7 +560,7 @@ def getFeed(urls):
|
|||||||
for post in userFeed[:-1]:
|
for post in userFeed[:-1]:
|
||||||
date_time_str = post.find('span', attrs={'class':'tweet-date'}).find('a')['title'].replace(",","")
|
date_time_str = post.find('span', attrs={'class':'tweet-date'}).find('a')['title'].replace(",","")
|
||||||
time = datetime.datetime.now() - datetime.datetime.strptime(date_time_str, '%d/%m/%Y %H:%M:%S')
|
time = datetime.datetime.now() - datetime.datetime.strptime(date_time_str, '%d/%m/%Y %H:%M:%S')
|
||||||
if time.days >=8:
|
if time.days >=7:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if post.find('div', attrs={'class':'pinned'}):
|
if post.find('div', attrs={'class':'pinned'}):
|
||||||
@ -608,8 +615,6 @@ def getPosts(account):
|
|||||||
for post in userFeed[:-1]:
|
for post in userFeed[:-1]:
|
||||||
date_time_str = post.find('span', attrs={'class':'tweet-date'}).find('a')['title'].replace(",","")
|
date_time_str = post.find('span', attrs={'class':'tweet-date'}).find('a')['title'].replace(",","")
|
||||||
time = datetime.datetime.now() - datetime.datetime.strptime(date_time_str, '%d/%m/%Y %H:%M:%S')
|
time = datetime.datetime.now() - datetime.datetime.strptime(date_time_str, '%d/%m/%Y %H:%M:%S')
|
||||||
if time.days >=8:
|
|
||||||
continue
|
|
||||||
|
|
||||||
if post.find('div', attrs={'class':'pinned'}):
|
if post.find('div', attrs={'class':'pinned'}):
|
||||||
if post.find('div', attrs={'class':'pinned'}).find('span', attrs={'icon-pin'}):
|
if post.find('div', attrs={'class':'pinned'}).find('span', attrs={'icon-pin'}):
|
||||||
@ -660,7 +665,7 @@ def getYoutubePosts(ids):
|
|||||||
for vid in rssFeed.entries:
|
for vid in rssFeed.entries:
|
||||||
time = datetime.datetime.now() - datetime.datetime(*vid.published_parsed[:6])
|
time = datetime.datetime.now() - datetime.datetime(*vid.published_parsed[:6])
|
||||||
|
|
||||||
if time.days >=8:
|
if time.days >=7:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
video = ytPost()
|
video = ytPost()
|
||||||
@ -671,7 +676,7 @@ def getYoutubePosts(ids):
|
|||||||
video.channelUrl = vid.author_detail.href
|
video.channelUrl = vid.author_detail.href
|
||||||
video.id = vid.yt_videoid
|
video.id = vid.yt_videoid
|
||||||
video.videoTitle = vid.title
|
video.videoTitle = vid.title
|
||||||
video.videoThumb = vid.media_thumbnail[0]['url']
|
video.videoThumb = vid.media_thumbnail[0]['url'].replace('/', '~')
|
||||||
video.views = vid.media_statistics['views']
|
video.views = vid.media_statistics['views']
|
||||||
video.description = vid.summary_detail.value
|
video.description = vid.summary_detail.value
|
||||||
video.description = re.sub(r'^https?:\/\/.*[\r\n]*', '', video.description[0:120]+"...", flags=re.MULTILINE)
|
video.description = re.sub(r'^https?:\/\/.*[\r\n]*', '', video.description[0:120]+"...", flags=re.MULTILINE)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="image">
|
<div class="image">
|
||||||
<img alt="Thumbnail" src="{{video.videoThumb}}">
|
<img alt="Thumbnail" src="/img/{{video.videoThumb}}">
|
||||||
</div>
|
</div>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<a class="video-title break-word" href="{{url_for('watch', v=video.id, _method='GET')}}">{{video.videoTitle}}</a>
|
<a class="video-title break-word" href="{{url_for('watch', v=video.id, _method='GET')}}">{{video.videoTitle}}</a>
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
|
||||||
{% if title %}
|
{% if title %}
|
||||||
<title>{{ title }} - Parassiter</title>
|
<title>{{ title }} - Parassiter</title>
|
||||||
{% else %}
|
{% else %}
|
||||||
|
Reference in New Issue
Block a user