Tool that displays, via [Wayback CDX Server API](https://github.com/internetarchive/wayback/tree/master/wayback-cdx-server), multiple archived tweets on Wayback Machine to avoid opening each link manually. The app is a prototype written in Python with Streamlit and hosted at Streamlit Cloud.
-*Thanks Tristan Lee for the idea.*
-
-## Features
-
- Tweets per page defined by user
- Filter by years
- Filter by only deleted tweets
+*Thanks Tristan Lee for the idea.*
+
## Development
### Requirement
## Bugs
- [ ] "web.archive.org took too long to respond."
-- [ ] Pagination: set session variable on first click
- [ ] Timeout error
- [x] `only_deleted` checkbox selected for handles without deleted tweets
+- [x] Pagination: set session variable on first click
- [x] Pagination: scroll to top
- [x] `IndexError`
>"A tool to quickly view tweets saved on archive.org." — [Irina_Tech_Tips Newsletter #3](https://irinatechtips.substack.com/p/irina_tech_tips-newsletter-3-2023#%C2%A7wayback-tweets)
-
## Contributing
PRs are welcome. Please, check the bug topic above, the [roadmap](docs/ROADMAP.md) or add a new feature.
st.markdown(hide_streamlit_style, unsafe_allow_html=True)
-if 'current_query' not in st.session_state:
- st.session_state.current_query = ''
-
if 'current_handle' not in st.session_state:
st.session_state.current_handle = ''
query = st.button('Query', type='primary', use_container_width=True)
-if query or st.session_state.count:
- if handle != st.session_state.current_handle:
- st.session_state.offset = 0
+if handle != st.session_state.current_handle:
+ st.session_state.offset = 0
- if query != st.session_state.current_query:
- st.session_state.offset = 0
+if query or st.session_state.count:
st.session_state.count = tweets_count(handle, st.session_state.saved_at)
st.divider()
st.session_state.current_handle = handle
- st.session_state.current_query = query
return_none_count = 0
st.error('Tweet has been deleted.')
try:
response_json = requests.get(link)
+
+ if response_json.status_code == 200:
+ json_data = response_json.json()
+
+ if 'data' in json_data:
+ if 'text' in json_data['data']:
+ json_text = json_data['data']['text']
+ else:
+ json_text = json_data['data']
+ else:
+ if 'text' in json_data:
+ json_text = json_data['text']
+ else:
+ json_text = json_data
+
+ st.code(json_text)
+ st.json(json_data, expanded=False)
+ else:
+ st.error(response_json.status_code)
except requests.exceptions.Timeout:
st.error('Connection to web.archive.org timed out.')
except requests.exceptions.ConnectionError:
st.error('Failed to establish a new connection with web.archive.org.')
except UnboundLocalError:
st.empty()
- if response_json.status_code == 200:
- json_data = response_json.json()
-
- if 'data' in json_data:
- if 'text' in json_data['data']:
- json_text = json_data['data']['text']
- else:
- json_text = json_data['data']
- else:
- if 'text' in json_data:
- json_text = json_data['text']
- else:
- json_text = json_data
-
- st.code(json_text)
- st.json(json_data, expanded=False)
- else:
- st.error(response_json.status_code)
st.divider()
if mimetype[i] == 'text/html':