Actually fixed broken descriptions (they were worse than we thought) (thanks maddie again)
This commit is contained in:
parent
ac581f49b2
commit
f90249fc05
1 changed files with 10 additions and 3 deletions
11
twitfix.py
11
twitfix.py
|
@ -110,8 +110,14 @@ def linkToVNFfromAPI(vidlink):
|
||||||
else:
|
else:
|
||||||
url = tweet['extended_entities']['media'][0]['video_info']['variants'][-2]['url']
|
url = tweet['extended_entities']['media'][0]['video_info']['variants'][-2]['url']
|
||||||
|
|
||||||
text = textwrap.shorten(tweet['full_text'], width=200, placeholder="...")
|
if len(tweet['full_text']) > 200:
|
||||||
|
text = textwrap.shorten(tweet['full_text'], width=200, placeholder="...")
|
||||||
|
else:
|
||||||
|
text = tweet['full_text']
|
||||||
|
|
||||||
print(text)
|
print(text)
|
||||||
|
print(len(text))
|
||||||
|
|
||||||
vnf = vidInfo(url, vidlink, text, tweet['extended_entities']['media'][0]['media_url'], tweet['user']['name'])
|
vnf = vidInfo(url, vidlink, text, tweet['extended_entities']['media'][0]['media_url'], tweet['user']['name'])
|
||||||
return vnf
|
return vnf
|
||||||
|
|
||||||
|
@ -184,7 +190,8 @@ def addVNFtoLinkCache(vidlink, vnf):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def embed(vidlink, vnf):
|
def embed(vidlink, vnf):
|
||||||
return render_template('index.html', vidurl=vnf['url'], desc=vnf['description'], pic=vnf['thumbnail'], user=vnf['uploader'], vidlink=vidlink)
|
desc = re.sub(r' http.*t\.co\S+', '', vnf['description'].replace("#","#"))
|
||||||
|
return render_template('index.html', vidurl=vnf['url'], desc=desc, pic=vnf['thumbnail'], user=vnf['uploader'], vidlink=vidlink)
|
||||||
|
|
||||||
def oEmbedGen(description, user, vidlink):
|
def oEmbedGen(description, user, vidlink):
|
||||||
out = {
|
out = {
|
||||||
|
|
Loading…
Reference in a new issue