update docs, fiz viz class
authorClaromes <claromes@hey.com>
Mon, 24 Jun 2024 19:47:08 +0000 (16:47 -0300)
committerClaromes <claromes@hey.com>
Mon, 24 Jun 2024 19:47:08 +0000 (16:47 -0300)
app/app.py
app/requirements.txt
pyproject.toml
waybacktweets/api/visualize.py

index 379c892256f6e2cf390383861897a87488d38e9a..50ebe1fa18b958ef3aee91cef042e9d8b6e6ea19 100644 (file)
@@ -17,7 +17,7 @@ DOWNLOAD = "assets/download.svg"
 
 collapse = None
 matchtype = None
-start_date = datetime.now() - timedelta(days=365 * 2)
+start_date = datetime.now() - timedelta(days=30 * 6)
 end_date = datetime.now()
 min_date = datetime(2006, 1, 1)
 
@@ -126,7 +126,7 @@ def tweets_exporter(parsed_tweets, username, field_options):
 # ------ User Interface Settings ------ #
 
 st.info(
-    """🥳 [**Pre-release 1.0x: New Streamlit app, CLI and Python module**](https://claromes.github.io/waybacktweets)"""  # noqa: E501
+    "🥳 [**Pre-release 1.0a5: Python module, CLI, and new Streamlit app**](https://github.com/claromes/waybacktweets/releases/tag/v1.0a5)"  # noqa: E501
 )
 
 st.image(TITLE, use_column_width="never")
@@ -138,11 +138,11 @@ st.write(
 )
 
 st.write(
-    "This application uses the Wayback Tweets Python package, which can be used as a module or as a standalone command line tool. [Read the documentation](https://claromes.github.io/waybacktweets)."  # noqa: E501
+    "This application uses the Wayback Tweets Python package, which can be used either as a module or as a standalone command-line tool. [Read the documentation](https://claromes.github.io/waybacktweets) for more information.."  # noqa: E501
 )
 
 st.write(
-    "To access the legacy version of Wayback Tweets [click here](https://waybacktweets-legacy.streamlit.app)."  # noqa: E501
+    "To access the legacy version of Wayback Tweets, [click here](https://waybacktweets-legacy.streamlit.app)."  # noqa: E501
 )
 
 st.divider()
@@ -153,9 +153,6 @@ username = st.text_input("Username *", key="username", placeholder="Without @")
 
 with st.expander("Filtering"):
 
-    st.caption(
-        ":orange[A large date range takes a long time to process, and the app's resources may not be sufficient. Try to perform searches with smaller ranges to get faster results.]"  # noqa: E501
-    )
     st.session_state.archived_timestamp_filter = st.date_input(
         "Tweets saved between",
         (start_date, end_date),
@@ -164,6 +161,9 @@ with st.expander("Filtering"):
         format="YYYY/MM/DD",
         help="Using the `from` and `to` filters. Format: YYYY/MM/DD",
     )
+    st.caption(
+        ":orange[note: large date range takes a long time to process, and the app's resources may not be sufficient. Try to perform searches with smaller ranges to get faster results.]"  # noqa: E501
+    )
 
     col1, col2 = st.columns(2)
 
@@ -186,6 +186,9 @@ with st.expander("Filtering"):
         key="unique",
         help="Filtering by the collapse option using the `urlkey` field and the URL Match Scope `prefix`",  # noqa: E501
     )
+    st.caption(
+        ":orange[note: according to the official documentation of the Wayback CDX Server API, the query to retrieve unique URLs may be slow at the moment.]"  # noqa: E501
+    )
 
 
 query = st.button("Query", type="primary", use_container_width=True)
@@ -244,7 +247,7 @@ if query or st.session_state.count:
 
             st.header("HTML", divider="gray")
             st.write(
-                f"Visualize tweets more efficiently through iframes. Download the @{st.session_state.current_username}'s archived tweets in HTML."  # noqa: E501
+                f"Visualize tweets more efficiently through `iframes`. Download the @{st.session_state.current_username}'s archived tweets in HTML."  # noqa: E501
             )
 
             col5, col6 = st.columns([1, 18])
index 9d8ab55ffc4715f5e5977f66662d08bd26256f39..54dfe4dd5ef57c97bda60031d0b2a8d4fcdf60d7 100644 (file)
@@ -1,2 +1,2 @@
 streamlit==1.36.0
-waybacktweets==1.0a3
+waybacktweets==1.0a5
index f3ccec6be6ac50b43c8fa8940d5c72caeba94b85..4467d49d75010adf418bcabc2d644fb1d9c4004f 100644 (file)
@@ -1,6 +1,6 @@
 [tool.poetry]
 name = "waybacktweets"
-version = "1.0a4"
+version = "1.0a5"
 description = "Retrieves archived tweets CDX data from the Wayback Machine, performs necessary parsing, and saves the data."
 authors = ["Claromes <support@claromes.com>"]
 license = "GPLv3"
index 66216671896d8408955d1fa24e55014ea515176d..93ad80ac6c6a59bd0b5f2670ac7b313cb6cee099 100644 (file)
@@ -57,12 +57,15 @@ class HTMLTweetsVisualizer:
         tweets_per_page = 24
         total_pages = (len(self.json_path) + tweets_per_page - 1) // tweets_per_page
 
-        html = "<html>\n"
-        html = f"<!-- This document was generated by Wayback Tweets. Visit: https://claromes.github.io/waybacktweets -->\n"
+        html = "<!DOCTYPE html>\n"
+        html += '<html lang="en">\n'
+        html += "<!-- This document was generated by Wayback Tweets. Visit: https://claromes.github.io/waybacktweets -->\n"
 
-        html += "\n<head>"
-        html += '<meta charset="utf-8" />\n'
-        html += '<meta name="viewport" content="width=device-width, initial-scale=1">\n'
+        html += "<head>"
+        html += '<meta charset="UTF-8">\n'
+        html += (
+            '<meta name="viewport" content="width=device-width, initial-scale=1.0">\n'
+        )
         html += f"<title>@{self.username}'s archived tweets</title>\n"
 
         # Adds styling
@@ -85,7 +88,7 @@ class HTMLTweetsVisualizer:
             "input:checked ~ .accordion-content { max-height: 100vh; padding: 1em; }\n"
         )
         html += ".pagination { text-align: center; margin-top: 20px; }\n"
-        html += ".pagination a { margin: 0 5px; text-decoration: none; color: #000000; padding: 10px 15px; border: 1px solid #e2e2e2; border-radius: 5px; }\n"
+        html += ".pagination a { margin: 0 5px; text-decoration: none; color: #000000; padding: 1px 2px; border-radius: 5px; }\n"
         html += ".pagination a:hover { background-color: #e2e2e2; }\n"
         html += ".pagination a.selected { background-color: #e2e2e2; color: #000000; font-weight: bold; }\n"
         html += "</style>\n"
@@ -202,7 +205,8 @@ class HTMLTweetsVisualizer:
             total_pages=total_pages
         )
 
-        html += "</body>\n</html>"
+        html += "</body>\n"
+        html += "</html>"
 
         return html