# 🏛️ Wayback Tweets
-[](https://github.com/claromes/waybacktweets/releases)
+[](https://github.com/claromes/waybacktweets/releases)
-Archived tweets on Wayback Machine in an easy way
+Tool that displays multiple archived tweets on Wayback Machine to avoid opening each link manually.
[waybacktweets.streamlit.app](https://waybacktweets.streamlit.app/)
## Development
-### Requirements
+### Requirement
- Python 3.8+
- [x] Pagination
- [x] Footer
- [x] Disabled/ Empty
-- [ ] Feedbacks
+- [x] Feedbacks
- [ ] Download dataset
- [ ] Review data cache
- [ ] Range size defined by user
- [ ] Prevent duplicate URLs
- [ ] Hide Twitter header banner (iframe)
-- [ ] Contributing/ Docs
- [ ] Changelog
- [ ] `parse_links` exception
import streamlit as st
import streamlit.components.v1 as components
-__version__ = '0.1.3.2'
+__version__ = '0.1.4-beta'
+
+year = datetime.datetime.now().year
st.set_page_config(
page_title='Wayback Tweets',
page_icon='🏛️',
- layout='centered'
-)
+ layout='centered',
+ menu_items={
-# https://discuss.streamlit.io/t/remove-hide-running-man-animation-on-top-of-page/21773/3
-hide_streamlit_style = '''
-<style>
- div[data-testid="stToolbar"] {
- visibility: hidden;
- height: 0%;
- position: fixed;
- }
- div[data-testid="stDecoration"] {
- visibility: hidden;
- height: 0%;
- position: fixed;
- }
- div[data-testid="stStatusWidget"] {
- visibility: hidden;
- height: 0%;
- position: fixed;
- }
- #MainMenu {
- visibility: hidden;
- height: 0%;
- }
- header {
- visibility: hidden;
- height: 0%;
- }
- footer {
- visibility: hidden;
- height: 0%;
- }
-</style>
-'''
+ 'About': '''
+ ## 🏛️ Wayback Tweets
-st.markdown(hide_streamlit_style, unsafe_allow_html=True)
+ [](https://github.com/claromes/waybacktweets/releases) [](https://github.com/claromes/waybacktweets/blob/main/LICENSE.md)
+
+ Tool that displays multiple archived tweets on Wayback Machine to avoid opening each link manually.
+
+ This tool is experimental, please feel free to send your [feedbacks](https://github.com/claromes/waybacktweets/issues).
+
+ Copyright © {}, [claromes.gitlab.io](https://claromes.gitlab.io).
+
+ -------
+ '''.format(year),
+ 'Report a bug': 'https://github.com/claromes/waybacktweets/issues'
+ }
+)
if 'current_index' not in st.session_state:
st.session_state.current_index = 0
components.html(js, width=0, height=0)
-@st.cache_data(ttl=1800, show_spinner=False)
+@st.cache_data(ttl=3600, show_spinner=False)
def embed(tweet):
api = 'https://publish.twitter.com/oembed?url={}'.format(tweet)
response = requests.get(api)
else:
return None
-@st.cache_data(ttl=1800, show_spinner=False)
+@st.cache_data(ttl=3600, show_spinner=False)
def query_api(handle):
if not handle:
st.warning('username, please!')
else:
return None
-@st.cache_data(ttl=1800, show_spinner=False)
+@st.cache_data(ttl=3600, show_spinner=False)
def parse_links(links):
parsed_links = []
timestamp = []
return parsed_links, tweet_links, parsed_mimetype, timestamp
+@st.cache_data(ttl=3600, show_spinner=False)
def attr(i):
st.markdown('''
{}. **Wayback Machine:** [link]({}) | **MIME Type:** {} | **From:** {} | **Tweet:** [link]({})
'''.format(i+1, link, mimetype[i], datetime.datetime.strptime(timestamp[i], "%Y%m%d%H%M%S"), tweet_links[i]))
st.title('''
-Wayback Tweets
-[](https://github.com/claromes/waybacktweets/releases)
+Wayback Tweets [](https://github.com/claromes/waybacktweets/releases)
''', anchor=False)
-st.write('Search archived tweets on Wayback Machine in an easy way')
+st.write('''
+Display multiple archived tweets on Wayback Machine and avoid opening each link manually
+
+*via Wayback CDX Server API*
+''')
handle = st.text_input('username', placeholder='username', label_visibility='collapsed')
query = st.button('Query', type='primary', use_container_width=True)