From: Claromes Date: Tue, 14 Nov 2023 00:14:16 +0000 (-0300) Subject: update roadmap, fix mimetype X-Git-Url: https://git.claromes.com/?a=commitdiff_plain;h=3c4a48cd979284af0a3fe0b6db32de4ea2d05b0a;p=waybacktweets.git update roadmap, fix mimetype --- diff --git a/app.py b/app.py index 3dfc615..539b087 100644 --- a/app.py +++ b/app.py @@ -209,12 +209,16 @@ def next_page(): scroll_into_view() def display_tweet(): - if is_RT[0] == True: - st.info('*Retweet*') - st.write(tweet_content[0]) - st.write(f'**{user_info[0]}**') - - st.divider() + if mimetype[i] == 'application/json' or mimetype[i] == 'text/html': + if is_RT[0] == True: + st.info('*Retweet*') + st.write(tweet_content[0]) + st.write(f'**{user_info[0]}**') + st.divider() + else: + print('tweet') + st.warning('MIME Type was not parsed.') + st.divider() def display_not_tweet(): if mimetype[i] == 'application/json': @@ -238,28 +242,26 @@ def display_not_tweet(): st.code(json_text) st.json(json_data, expanded=False) + st.divider() else: st.error(response_json.status_code) + st.divider() except requests.exceptions.Timeout: st.error('Connection to web.archive.org timed out.') + st.divider() except requests.exceptions.ConnectionError: st.error('Failed to establish a new connection with web.archive.org.') + st.divider() except UnboundLocalError: st.empty() - - if mimetype[i] == 'text/html': + elif mimetype[i] == 'text/html': st.error('Tweet has been deleted.') components.iframe(link, height=500, scrolling=True) - st.divider() - if mimetype[i] == 'warc/revisit': - st.warning('''MIME Type was not parsed.''') - - st.divider() - if mimetype[i] == 'text/plain': - st.warning('''MIME Type was not parsed.''') - + else: + print('display_not_tweet') + st.warning('MIME Type was not parsed.') st.divider() # UI @@ -325,18 +327,7 @@ if query or st.session_state.count: user_info = tweet[2] is_RT = tweet[3] - if mimetype[i] == 'application/json': - display_tweet() - - if mimetype[i] == 'text/html': - display_tweet() - - if mimetype[i] == 'warc/revisit': - st.warning('''MIME Type was not parsed.''') - - st.divider() - if mimetype[i] == 'text/plain': - st.warning('''MIME Type was not parsed.''') + display_tweet() elif not tweet: display_not_tweet() diff --git a/docs/ROADMAP.md b/docs/ROADMAP.md index 04a30e2..7f67c09 100644 --- a/docs/ROADMAP.md +++ b/docs/ROADMAP.md @@ -12,6 +12,7 @@ - [ ] `parse_links` exception - [ ] Parse MIME type `warc/revisit` - [ ] Parse MIME type `text/plain` +- [ ] Parse MIME type `application/http` - [x] Filter by period/datetime - [ ] Apply filters by API endpoints - [x] Add contributing guidelines \ No newline at end of file