From 3dbb76d6a34232b11dd198ce89018a629d5631c5 Mon Sep 17 00:00:00 2001 From: pluja Date: Tue, 6 Oct 2020 19:09:14 +0200 Subject: [PATCH] Fixes some twitter profiles crashing This was caused by line 874, when a tweet was not available --- app/routes.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/app/routes.py b/app/routes.py index 1e6151d..6d9a38a 100644 --- a/app/routes.py +++ b/app/routes.py @@ -397,7 +397,7 @@ def get_best_urls(urls): for url in urls: for f in best_formats: if url['format_id'] == f: - best_urls.append(url) + best_urls.append(url) return best_urls def get_live_urls(urls): @@ -432,11 +432,10 @@ def watch(): if info['video']['isUpcoming']: vid_urls=[] + elif info['video']['isLive']: + vid_urls = get_live_urls(info['video']['urls']) else: vid_urls = get_best_urls(info['video']['urls']) - - if info['video']['isLive']: - vid_urls = get_live_urls(info['video']['urls']) video={ 'title':info['video']['title'], @@ -872,7 +871,10 @@ def getPosts(account): if quote.find('a', attrs={'class':'still-image'}): newPost.replyAttachedImg = NITTERINSTANCE+quote.find('a', attrs={'class':'still-image'})['href'][1:] - newPost.replyingUser=quote.find('a', attrs={'class':'username'}).text + try: + newPost.replyingUser=quote.find('a', attrs={'class':'username'}).text + except: + newPost.replyingUser="Unavailable" post.find('div', attrs={'class':'quote'}).decompose() if post.find('div', attrs={'class':'attachments'}):