*.json
*.html
waybacktweets/__pycache__
+waybacktweets/api/__pycache__
+waybacktweets/cli/__pycache__
+waybacktweets/utils/__pycache__
+docs/_build/
notes.md
import streamlit as st
import streamlit.components.v1 as components
-from waybacktweets.export_tweets import TweetsExporter
-from waybacktweets.parse_tweets import TweetsParser
-from waybacktweets.request_tweets import WaybackTweets
-from waybacktweets.utils import check_double_status, get_response
+from waybacktweets.api.export_tweets import TweetsExporter
+from waybacktweets.api.parse_tweets import TweetsParser
+from waybacktweets.api.request_tweets import WaybackTweets
+from waybacktweets.utils.utils import check_double_status, get_response
# Initial Settings
return total_tweets
else:
return 0
- except requests.exceptions.Timeout:
+ except requests.exceptions.ReadTimeout:
st.error("Connection to web.archive.org timed out.")
st.stop()
except requests.exceptions.ConnectionError:
st.error("Failed to establish a new connection with web.archive.org.")
st.stop()
- except UnboundLocalError:
- st.empty()
# Interface Settings
# Display all tweets
if not not_available:
st.markdown(
- f'{i+1 + st.session_state.offset}. [**archived url ↗**]({archived_tweet_url[i]}) · [**tweet url ↗**]({original_tweet_url[i]}) · **MIME type:** {archived_mimetype[i]} · **archived timestamp:** {datetime.datetime.strptime(str(archived_timestamp[i]), "%Y%m%d%H%M%S")} · **archived status code:** {archived_statuscode[i]}' # noqa: E501
+ f'{i+1 + st.session_state.offset}. [**archived url ↗**]({archived_tweet_url[i]}) · [**tweet url ↗**]({original_tweet_url[i]}) · **mimetype:** {archived_mimetype[i]} · **archived timestamp:** {datetime.datetime.strptime(str(archived_timestamp[i]), "%Y%m%d%H%M%S")} · **archived status code:** {archived_statuscode[i]}' # noqa: E501
)
# Display available tweets
st.divider()
- # Display tweets not available with text/html, unk, warc/revisit MIME type or application/json MIME type without parsed JSON text # noqa: E501
+ # Display tweets not available with text/html, unk, warc/revisit mimetype or application/json mimetype without parsed JSON text # noqa: E501
elif (
(
archived_mimetype[i] != "application/json"
st.divider()
- # Display tweets not available with application/json MIME type and parsed JSON text # noqa: E501
+ # Display tweets not available with application/json mimetype and parsed JSON text # noqa: E501
elif (
archived_mimetype[i] == "application/json"
and parsed_tweet_text_mimetype_json[i]
return_none_count += 1
st.markdown(
- f'{i+1 + st.session_state.offset}. [**archived url ↗**]({archived_tweet_url[i]}) · [**tweet url ↗**]({original_tweet_url[i]}) · **MIME type:** {archived_mimetype[i]} · **archived timestamp:** {datetime.datetime.strptime(str(archived_timestamp[i]), "%Y%m%d%H%M%S")} · **archived status code:** {archived_statuscode[i]}' # noqa: E501
+ f'{i+1 + st.session_state.offset}. [**archived url ↗**]({archived_tweet_url[i]}) · [**tweet url ↗**]({original_tweet_url[i]}) · **mimetype:** {archived_mimetype[i]} · **archived timestamp:** {datetime.datetime.strptime(str(archived_timestamp[i]), "%Y%m%d%H%M%S")} · **archived status code:** {archived_statuscode[i]}' # noqa: E501
)
# Display tweets not available with text/html, unk, warc/revisit return # noqa: E501
--- /dev/null
+# Minimal makefile for Sphinx documentation
+#
+
+# You can set these variables from the command line, and also
+# from the environment for the first two.
+SPHINXOPTS ?=
+SPHINXBUILD ?= sphinx-build
+SOURCEDIR = .
+BUILDDIR = _build
+
+# Put it first so that "make" without argument is like "make help".
+help:
+ @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
+
+.PHONY: help Makefile
+
+# Catch-all target: route all unknown targets to Sphinx using the new
+# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
+%: Makefile
+ @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
--- /dev/null
+#cli #usage #wbt h3 {
+ display: none;
+}
--- /dev/null
+<svg width="400" height="400" viewBox="0 0 400 400" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M66.3377 155.388C65.7708 151.515 66.1155 142.825 71.4265 141.899C79.0689 140.57 79.2956 146.18 84.6566 147.58C96.4535 150.665 174.292 120.705 191.564 116.358C198.101 114.713 198.198 105 210.563 105C216.167 105 212.949 113.528 227.103 117.659C231.821 119.036 321.537 144.755 335.638 153.613C336.375 154.076 342.097 149.711 345.475 149.711C349.585 149.711 348.061 156.318 347.512 158.231" stroke="black" stroke-opacity="0.9" stroke-width="12" stroke-linecap="round" stroke-linejoin="round"/>
+<path d="M76.0438 157.18C104.715 153.671 133.644 159.144 162.337 159.144C180.702 159.144 198.876 159.796 217.155 160.78C232.592 161.607 248.391 161.432 263.851 161.432C268.61 161.432 339.399 162.499 339.992 163.068C341.344 164.376 339.313 175.156 339.313 177.794C339.313 179.238 340.507 188.39 339.992 188.592C312.456 199.24 148.067 185.975 105.484 185.975C100.317 185.975 74.2748 188.841 70.6327 185.319C69.0401 183.779 71.0896 170.186 71.3068 167.649" stroke="black" stroke-opacity="0.9" stroke-width="12" stroke-linecap="round" stroke-linejoin="round"/>
+<path d="M50.2399 286.757C48.2835 274.679 58.8072 280.438 63.1705 276.216C65.5956 273.869 62.1377 268.977 67.2563 267.326C86.9115 260.985 201.221 265.128 226.173 267.326C254.045 269.778 307.073 262.416 331.665 271.936C337.53 274.208 346.898 286.066 349.359 294" stroke="black" stroke-opacity="0.9" stroke-width="12" stroke-linecap="round" stroke-linejoin="round"/>
+<path d="M78.54 192.729C75.2103 217.791 74.8765 243.244 74.8765 268.404" stroke="black" stroke-opacity="0.9" stroke-width="12" stroke-linecap="round" stroke-linejoin="round"/>
+<path d="M95.6602 189.392C95.5489 213.231 94.1778 238.972 96.1587 261.728" stroke="black" stroke-opacity="0.9" stroke-width="12" stroke-linecap="round" stroke-linejoin="round"/>
+<path d="M120.11 189.392C117.82 213.426 116.295 237.66 114.546 261.728" stroke="black" stroke-opacity="0.9" stroke-width="12" stroke-linecap="round" stroke-linejoin="round"/>
+<path d="M133.018 191.617C130.467 214.481 133.489 242.725 131.687 262.84" stroke="black" stroke-opacity="0.9" stroke-width="12" stroke-linecap="round" stroke-linejoin="round"/>
+<path d="M156.834 190.504C155.165 212.389 152.383 234.105 152.383 256.163" stroke="black" stroke-opacity="0.9" stroke-width="12" stroke-linecap="round" stroke-linejoin="round"/>
+<path d="M170.257 192.729C170.227 216.032 169.009 239.434 169.009 262.84" stroke="black" stroke-opacity="0.9" stroke-width="12" stroke-linecap="round" stroke-linejoin="round"/>
+<path d="M127.227 203.675C125.215 203.711 123.631 203.17 121.895 202.927" stroke="black" stroke-opacity="0.9" stroke-width="12" stroke-linecap="round" stroke-linejoin="round"/>
+<path d="M164.531 202.629C161.934 203.12 160.138 201.951 158.041 201.631" stroke="black" stroke-opacity="0.9" stroke-width="12" stroke-linecap="round" stroke-linejoin="round"/>
+<path d="M194.64 190.504C194.317 211.918 192.477 233.888 192.477 255.05" stroke="black" stroke-opacity="0.9" stroke-width="12" stroke-linecap="round" stroke-linejoin="round"/>
+<path d="M211.075 192.729C210.357 215.678 210.574 238.717 210.574 261.727" stroke="black" stroke-opacity="0.9" stroke-width="12" stroke-linecap="round" stroke-linejoin="round"/>
+<path d="M234.735 198.294C230.696 217.051 233.372 237.419 230.283 256.163" stroke="black" stroke-opacity="0.9" stroke-width="12" stroke-linecap="round" stroke-linejoin="round"/>
+<path d="M247.257 198.294C247.517 219.421 248.118 240.78 248.922 261.727" stroke="black" stroke-opacity="0.9" stroke-width="12" stroke-linecap="round" stroke-linejoin="round"/>
+<path d="M276.09 198.294C276.696 219.814 273.428 241.434 273.428 262.84" stroke="black" stroke-opacity="0.9" stroke-width="12" stroke-linecap="round" stroke-linejoin="round"/>
+<path d="M293.809 199.407C293.414 220.715 294.808 241.656 294.808 262.84" stroke="black" stroke-opacity="0.9" stroke-width="12" stroke-linecap="round" stroke-linejoin="round"/>
+<path d="M321 199.407C320.7 220.28 317.879 247.076 319.001 265.066" stroke="black" stroke-opacity="0.9" stroke-width="12" stroke-linecap="round" stroke-linejoin="round"/>
+<path d="M335.889 198.294C335.35 223.471 333.895 248.801 333.895 273.968" stroke="black" stroke-opacity="0.9" stroke-width="12" stroke-linecap="round" stroke-linejoin="round"/>
+<path d="M196.897 203.278C200.248 202.326 202.739 203.495 205.8 203.695" stroke="black" stroke-opacity="0.9" stroke-width="12" stroke-linecap="round" stroke-linejoin="round"/>
+<path d="M233.622 204.357C235.117 204.099 236.593 203.716 238.074 203.36" stroke="black" stroke-opacity="0.9" stroke-width="12" stroke-linecap="round" stroke-linejoin="round"/>
+<path d="M281.475 207.848C282.979 208.035 284.481 207.724 285.926 207.601" stroke="black" stroke-opacity="0.9" stroke-width="12" stroke-linecap="round" stroke-linejoin="round"/>
+<path d="M81.1602 206.21C82.665 206.459 84.1663 206.045 85.6116 205.88" stroke="black" stroke-opacity="0.9" stroke-width="12" stroke-linecap="round" stroke-linejoin="round"/>
+<path d="M324.876 210.348C328.342 210.461 331.54 209.814 334.892 209.597" stroke="black" stroke-opacity="0.9" stroke-width="12" stroke-linecap="round" stroke-linejoin="round"/>
+</svg>
--- /dev/null
+API
+====
+
+Request
+---------
+
+.. module:: waybacktweets.api.request_tweets
+
+.. autoclass:: WaybackTweets
+ :members:
+
+
+
+Parse
+---------
+
+.. module:: waybacktweets.api.parse_tweets
+
+.. autoclass:: TweetsParser
+ :members:
+
+.. autoclass:: TwitterEmbed
+ :members:
+
+.. autoclass:: JsonParser
+ :members:
+
+
+Export
+---------
+
+.. module:: waybacktweets.api.export_tweets
+
+.. autoclass:: TweetsExporter
+ :members:
+
+
+Visualizer
+-----------
+
+.. module:: waybacktweets.api.viz_tweets
+
+.. autoclass:: HTMLTweetsVisualizer
+ :members:
+
+
+Utils
+-------
+
+.. module:: waybacktweets.utils.utils
+
+.. autofunction:: check_double_status
+.. autofunction:: check_pattern_tweet
+.. autofunction:: clean_tweet_url
+.. autofunction:: clean_wayback_machine_url
+.. autofunction:: delete_tweet_pathnames
+.. autofunction:: get_response
+.. autofunction:: parse_date
+.. autofunction:: semicolon_parser
+++ /dev/null
-<svg width="400" height="400" viewBox="0 0 400 400" fill="none" xmlns="http://www.w3.org/2000/svg">
-<path d="M66.3377 155.388C65.7708 151.515 66.1155 142.825 71.4265 141.899C79.0689 140.57 79.2956 146.18 84.6566 147.58C96.4535 150.665 174.292 120.705 191.564 116.358C198.101 114.713 198.198 105 210.563 105C216.167 105 212.949 113.528 227.103 117.659C231.821 119.036 321.537 144.755 335.638 153.613C336.375 154.076 342.097 149.711 345.475 149.711C349.585 149.711 348.061 156.318 347.512 158.231" stroke="white" stroke-opacity="0.9" stroke-width="16" stroke-linecap="round" stroke-linejoin="round"/>
-<path d="M76.0438 157.18C104.715 153.671 133.644 159.144 162.337 159.144C180.702 159.144 198.876 159.796 217.155 160.78C232.592 161.607 248.391 161.432 263.851 161.432C268.61 161.432 339.399 162.499 339.992 163.068C341.344 164.376 339.313 175.156 339.313 177.794C339.313 179.238 340.507 188.39 339.992 188.592C312.456 199.24 148.067 185.975 105.484 185.975C100.317 185.975 74.2748 188.841 70.6327 185.319C69.0401 183.779 71.0896 170.186 71.3068 167.649" stroke="white" stroke-opacity="0.9" stroke-width="16" stroke-linecap="round" stroke-linejoin="round"/>
-<path d="M50.2399 286.757C48.2835 274.679 58.8072 280.438 63.1705 276.216C65.5956 273.869 62.1377 268.977 67.2563 267.326C86.9115 260.985 201.221 265.128 226.173 267.326C254.045 269.778 307.073 262.416 331.665 271.936C337.53 274.208 346.898 286.066 349.359 294" stroke="white" stroke-opacity="0.9" stroke-width="16" stroke-linecap="round" stroke-linejoin="round"/>
-<path d="M78.54 192.729C75.2103 217.791 74.8765 243.244 74.8765 268.404" stroke="white" stroke-opacity="0.9" stroke-width="16" stroke-linecap="round" stroke-linejoin="round"/>
-<path d="M95.6602 189.392C95.5489 213.231 94.1778 238.972 96.1587 261.728" stroke="white" stroke-opacity="0.9" stroke-width="16" stroke-linecap="round" stroke-linejoin="round"/>
-<path d="M120.11 189.392C117.82 213.426 116.295 237.66 114.546 261.728" stroke="white" stroke-opacity="0.9" stroke-width="16" stroke-linecap="round" stroke-linejoin="round"/>
-<path d="M133.018 191.617C130.467 214.481 133.489 242.725 131.687 262.84" stroke="white" stroke-opacity="0.9" stroke-width="16" stroke-linecap="round" stroke-linejoin="round"/>
-<path d="M156.834 190.504C155.165 212.389 152.383 234.105 152.383 256.163" stroke="white" stroke-opacity="0.9" stroke-width="16" stroke-linecap="round" stroke-linejoin="round"/>
-<path d="M170.257 192.729C170.227 216.032 169.009 239.434 169.009 262.84" stroke="white" stroke-opacity="0.9" stroke-width="16" stroke-linecap="round" stroke-linejoin="round"/>
-<path d="M127.227 203.675C125.215 203.711 123.631 203.17 121.895 202.927" stroke="white" stroke-opacity="0.9" stroke-width="16" stroke-linecap="round" stroke-linejoin="round"/>
-<path d="M164.531 202.629C161.934 203.12 160.138 201.951 158.041 201.631" stroke="white" stroke-opacity="0.9" stroke-width="16" stroke-linecap="round" stroke-linejoin="round"/>
-<path d="M194.64 190.504C194.317 211.918 192.477 233.888 192.477 255.05" stroke="white" stroke-opacity="0.9" stroke-width="16" stroke-linecap="round" stroke-linejoin="round"/>
-<path d="M211.075 192.729C210.357 215.678 210.574 238.717 210.574 261.727" stroke="white" stroke-opacity="0.9" stroke-width="16" stroke-linecap="round" stroke-linejoin="round"/>
-<path d="M234.735 198.294C230.696 217.051 233.372 237.419 230.283 256.163" stroke="white" stroke-opacity="0.9" stroke-width="16" stroke-linecap="round" stroke-linejoin="round"/>
-<path d="M247.257 198.294C247.517 219.421 248.118 240.78 248.922 261.727" stroke="white" stroke-opacity="0.9" stroke-width="16" stroke-linecap="round" stroke-linejoin="round"/>
-<path d="M276.09 198.294C276.696 219.814 273.428 241.434 273.428 262.84" stroke="white" stroke-opacity="0.9" stroke-width="16" stroke-linecap="round" stroke-linejoin="round"/>
-<path d="M293.809 199.407C293.414 220.715 294.808 241.656 294.808 262.84" stroke="white" stroke-opacity="0.9" stroke-width="16" stroke-linecap="round" stroke-linejoin="round"/>
-<path d="M321 199.407C320.7 220.28 317.879 247.076 319.001 265.066" stroke="white" stroke-opacity="0.9" stroke-width="16" stroke-linecap="round" stroke-linejoin="round"/>
-<path d="M335.889 198.294C335.35 223.471 333.895 248.801 333.895 273.968" stroke="white" stroke-opacity="0.9" stroke-width="16" stroke-linecap="round" stroke-linejoin="round"/>
-<path d="M196.897 203.278C200.248 202.326 202.739 203.495 205.8 203.695" stroke="white" stroke-opacity="0.9" stroke-width="16" stroke-linecap="round" stroke-linejoin="round"/>
-<path d="M233.622 204.357C235.117 204.099 236.593 203.716 238.074 203.36" stroke="white" stroke-opacity="0.9" stroke-width="16" stroke-linecap="round" stroke-linejoin="round"/>
-<path d="M281.475 207.848C282.979 208.035 284.481 207.724 285.926 207.601" stroke="white" stroke-opacity="0.9" stroke-width="16" stroke-linecap="round" stroke-linejoin="round"/>
-<path d="M81.1602 206.21C82.665 206.459 84.1663 206.045 85.6116 205.88" stroke="white" stroke-opacity="0.9" stroke-width="16" stroke-linecap="round" stroke-linejoin="round"/>
-<path d="M324.876 210.348C328.342 210.461 331.54 209.814 334.892 209.597" stroke="white" stroke-opacity="0.9" stroke-width="16" stroke-linecap="round" stroke-linejoin="round"/>
-</svg>
--- /dev/null
+CLI
+================
+
+Usage
+---------
+
+.. click:: waybacktweets.cli.main:cli
+ :prog: wbt
+ :nested: full
--- /dev/null
+import datetime
+
+from pallets_sphinx_themes import ProjectLink, get_version
+
+project = "Wayback Tweets"
+copyright = (
+ f"2023 - {datetime.datetime.now().year}, Claromes · Icon by The Doodle Library"
+)
+author = "Claromes"
+release, version = get_version("waybacktweets")
+
+# -- General configuration ---------------------------------------------------
+
+extensions = [
+ "sphinx.ext.autodoc",
+ "sphinx.ext.extlinks",
+ "sphinx.ext.intersphinx",
+ "pallets_sphinx_themes",
+ "sphinxcontrib.mermaid",
+ "sphinx_new_tab_link",
+ "sphinx_click.ext",
+]
+
+templates_path = ["_templates"]
+exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
+autodoc_typehints = "description"
+
+
+# -- Options for HTML output -------------------------------------------------
+
+html_theme = "flask"
+html_static_path = ["_static"]
+html_css_files = ["css/custom.css"]
+html_context = {
+ "project_links": [
+ ProjectLink("PyPI Releases", "https://pypi.org/project/waybacktweets/"),
+ ProjectLink("Source Code", "https://github.com/claromes/waybacktweets/"),
+ ProjectLink(
+ "Issue Tracker", "https://github.com/claromes/waybacktweets/issues/"
+ ),
+ ProjectLink("Mastodon", "https://ruby.social/@claromes"),
+ ProjectLink("Bluesky", "https://bsky.app/profile/claromes.com"),
+ ]
+}
+html_sidebars = {
+ "index": ["project.html", "localtoc.html", "searchbox.html"],
+ "**": ["localtoc.html", "relations.html", "searchbox.html"],
+}
+html_favicon = "_static/parthenon.svg"
+html_logo = "_static/parthenon.svg"
+html_title = f"Wayback Tweets Documentation ({version})"
+html_show_sourcelink = False
--- /dev/null
+Contribute
+================
+
+Here are all the ways you can contribute to this project.
+
+Testing
+---------
+
+The best way to help is by using the package, either on the command line or as a module, suggesting improvements and reporting bugs. You're very welcome to `open an issue <https://github.com/claromes/waybacktweets/issues/>`_.
+
+
+Hacking
+---------
+
+If you have Python skills, contribute to the `code <https://github.com/claromes/waybacktweets/>`_.
+
+These are the prerequisites:
+
+- Python 3.11+
+- Poetry
+
+Install from the source, following `these instructions <installation.html>`_.
+
+Brief explanation about the code under the Wayback Tweets directory:
+
+- ``app``: Streamlit app
+- ``docs``: Documentation generated with Sphinx
+- ``waybacktweets/api``: Main package modules
+- ``waybacktweets/cli``: Command line Interface module
+- ``waybacktweets/utils``: Helper functions used in the package
+
+Sponsoring
+-----------
+
+You can also donate to the project's developer and maintainer, `Claromes <https://claromes.com>`_, via `GitHub Sponsor <https://github.com/sponsors/claromes>`_ or if you are interested in sponsoring the project you can contact via email at support at claromes dot com.
--- /dev/null
+Errors
+================
+
+These are the most common errors and are handled by the ``waybacktweets`` package.
+
+ReadTimeout
+----------------
+
+This error occurs when a request to the web.archive.org server takes too long to respond. The server could be overloaded or there could be network issues.
+
+The output message from the package would be: ``Connection to web.archive.org timed out.``
+
+ConnectionError
+----------------
+
+This error is raised when the package fails to establish a new connection with web.archive.org. This could be due to network issues or the server being down.
+
+The output message from the package would be: ``Failed to establish a new connection with web.archive.org. Max retries exceeded.``
+
+This is the error often returned when performing experimental parsing of URLs with the mimetype ``application/json``.
+
+The warning output message from the package would be: ``Connection error with https://web.archive.org/web/<TIMESTAMP>/https://twitter.com/<USERNAME>/status/<TWEET_ID>. Max retries exceeded. Error parsing the JSON, but the CDX data was saved.``
+
+HTTPError
+----------------
+
+This error occurs when the Internet Archive services are temporarily offline. This could be due to maintenance or server issues.
+
+The output message from the package would be: ``Temporarily Offline: Internet Archive services are temporarily offline. Please check Internet Archive Twitter feed (https://twitter.com/internetarchive) for the latest information.``
+
+
+++ /dev/null
-{width="150" .logo-center}
-
-# Wayback Tweets
-
-Retrieves archived tweets' CDX data from the Wayback Machine, performs necessary parsing, and saves the data.
-
-## Workflow
-
-```mermaid
-flowchart TB
- A[input Username] --> B[(Wayback Machine)]
- B --> C{embed Tweet URL\nvia Twitter Publisher}
- C --> |2xx/3xx| D[return Tweet text]
- C --> |4xx| E[return None]
- E --> F{request Archived\nTweet URL}
- F --> |2xx/3xx| I{Parsing}
- F --> |4xx| G[return Only CDX data]
- I --> |application/json| J[return JSON text]
- I --> |text/html| K[return HTML iframe tag]
-```
--- /dev/null
+.. rst-class:: hide-header
+
+Wayback Tweets
+================
+
+
+Wayback Tweets Documentation
+------------------------------
+
+Retrieves archived tweets' CDX data from the Wayback Machine, performs necessary parsing, and saves the data.
+
+
+User Guide
+------------
+
+.. toctree::
+ :maxdepth: 2
+
+ installation
+ quickstart
+ workflow
+ result
+ errors
+ contribute
+
+
+Command-Line Interface
+------------------------
+.. toctree::
+ :maxdepth: 2
+
+ cli
+
+
+API Reference
+---------------
+
+.. toctree::
+ :maxdepth: 2
+
+ api
+
+
+Streamlit Web App
+-------------------
+
+.. toctree::
+ :maxdepth: 2
+
+ streamlit
+
+
+Additional Information
+-----------------------
+
+.. toctree::
+ :maxdepth: 1
+
+.. raw:: html
+
+ <ul>
+ <li><a href="https://github.com/claromes/waybacktweets/blob/main/LICENSE.md" target="_blank">GPL-3.0 license</a></li>
+ <li><a href="https://github.com/claromes/waybacktweets/releases" target="_blank">Changes</a></li>
+ </ul>
+
+Indices and tables
+----------------------
+
+.. toctree::
+ :maxdepth: 2
+
+ genindex
+ modindex
+ search
--- /dev/null
+Installation
+================
+
+
+Using pip
+------------
+
+ .. code-block:: shell
+
+ pip install waybacktweets
+
+From source
+-------------
+
+ Clone the repository:
+
+ .. code-block:: shell
+
+ git clone git@github.com:claromes/waybacktweets.git
+
+ Change directory:
+
+ .. code-block:: shell
+
+ cd waybacktweets
+
+ Install poetry, if you haven't already:
+
+ .. code-block:: shell
+
+ pip install poetry
+
+
+ Install the dependencies:
+
+ .. code-block:: shell
+
+ poetry install
+
+`Read the Poetry CLI documentation <https://python-poetry.org/docs/cli/>`_.
+++ /dev/null
- GNU GENERAL PUBLIC LICENSE
- Version 3, 29 June 2007
-
-Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
-Everyone is permitted to copy and distribute verbatim copies
-of this license document, but changing it is not allowed.
-
- Preamble
-
-The GNU General Public License is a free, copyleft license for
-software and other kinds of works.
-
-The licenses for most software and other practical works are designed
-to take away your freedom to share and change the works. By contrast,
-the GNU General Public License is intended to guarantee your freedom to
-share and change all versions of a program--to make sure it remains free
-software for all its users. We, the Free Software Foundation, use the
-GNU General Public License for most of our software; it applies also to
-any other work released this way by its authors. You can apply it to
-your programs, too.
-
-When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-them if you wish), that you receive source code or can get it if you
-want it, that you can change the software or use pieces of it in new
-free programs, and that you know you can do these things.
-
-To protect your rights, we need to prevent others from denying you
-these rights or asking you to surrender the rights. Therefore, you have
-certain responsibilities if you distribute copies of the software, or if
-you modify it: responsibilities to respect the freedom of others.
-
-For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must pass on to the recipients the same
-freedoms that you received. You must make sure that they, too, receive
-or can get the source code. And you must show them these terms so they
-know their rights.
-
-Developers that use the GNU GPL protect your rights with two steps:
-(1) assert copyright on the software, and (2) offer you this License
-giving you legal permission to copy, distribute and/or modify it.
-
-For the developers' and authors' protection, the GPL clearly explains
-that there is no warranty for this free software. For both users' and
-authors' sake, the GPL requires that modified versions be marked as
-changed, so that their problems will not be attributed erroneously to
-authors of previous versions.
-
-Some devices are designed to deny users access to install or run
-modified versions of the software inside them, although the manufacturer
-can do so. This is fundamentally incompatible with the aim of
-protecting users' freedom to change the software. The systematic
-pattern of such abuse occurs in the area of products for individuals to
-use, which is precisely where it is most unacceptable. Therefore, we
-have designed this version of the GPL to prohibit the practice for those
-products. If such problems arise substantially in other domains, we
-stand ready to extend this provision to those domains in future versions
-of the GPL, as needed to protect the freedom of users.
-
-Finally, every program is threatened constantly by software patents.
-States should not allow patents to restrict development and use of
-software on general-purpose computers, but in those that do, we wish to
-avoid the special danger that patents applied to a free program could
-make it effectively proprietary. To prevent this, the GPL assures that
-patents cannot be used to render the program non-free.
-
-The precise terms and conditions for copying, distribution and
-modification follow.
-
- TERMS AND CONDITIONS
-
-0. Definitions.
-
-"This License" refers to version 3 of the GNU General Public License.
-
-"Copyright" also means copyright-like laws that apply to other kinds of
-works, such as semiconductor masks.
-
-"The Program" refers to any copyrightable work licensed under this
-License. Each licensee is addressed as "you". "Licensees" and
-"recipients" may be individuals or organizations.
-
-To "modify" a work means to copy from or adapt all or part of the work
-in a fashion requiring copyright permission, other than the making of an
-exact copy. The resulting work is called a "modified version" of the
-earlier work or a work "based on" the earlier work.
-
-A "covered work" means either the unmodified Program or a work based
-on the Program.
-
-To "propagate" a work means to do anything with it that, without
-permission, would make you directly or secondarily liable for
-infringement under applicable copyright law, except executing it on a
-computer or modifying a private copy. Propagation includes copying,
-distribution (with or without modification), making available to the
-public, and in some countries other activities as well.
-
-To "convey" a work means any kind of propagation that enables other
-parties to make or receive copies. Mere interaction with a user through
-a computer network, with no transfer of a copy, is not conveying.
-
-An interactive user interface displays "Appropriate Legal Notices"
-to the extent that it includes a convenient and prominently visible
-feature that (1) displays an appropriate copyright notice, and (2)
-tells the user that there is no warranty for the work (except to the
-extent that warranties are provided), that licensees may convey the
-work under this License, and how to view a copy of this License. If
-the interface presents a list of user commands or options, such as a
-menu, a prominent item in the list meets this criterion.
-
-1. Source Code.
-
-The "source code" for a work means the preferred form of the work
-for making modifications to it. "Object code" means any non-source
-form of a work.
-
-A "Standard Interface" means an interface that either is an official
-standard defined by a recognized standards body, or, in the case of
-interfaces specified for a particular programming language, one that
-is widely used among developers working in that language.
-
-The "System Libraries" of an executable work include anything, other
-than the work as a whole, that (a) is included in the normal form of
-packaging a Major Component, but which is not part of that Major
-Component, and (b) serves only to enable use of the work with that
-Major Component, or to implement a Standard Interface for which an
-implementation is available to the public in source code form. A
-"Major Component", in this context, means a major essential component
-(kernel, window system, and so on) of the specific operating system
-(if any) on which the executable work runs, or a compiler used to
-produce the work, or an object code interpreter used to run it.
-
-The "Corresponding Source" for a work in object code form means all
-the source code needed to generate, install, and (for an executable
-work) run the object code and to modify the work, including scripts to
-control those activities. However, it does not include the work's
-System Libraries, or general-purpose tools or generally available free
-programs which are used unmodified in performing those activities but
-which are not part of the work. For example, Corresponding Source
-includes interface definition files associated with source files for
-the work, and the source code for shared libraries and dynamically
-linked subprograms that the work is specifically designed to require,
-such as by intimate data communication or control flow between those
-subprograms and other parts of the work.
-
-The Corresponding Source need not include anything that users
-can regenerate automatically from other parts of the Corresponding
-Source.
-
-The Corresponding Source for a work in source code form is that
-same work.
-
-2. Basic Permissions.
-
-All rights granted under this License are granted for the term of
-copyright on the Program, and are irrevocable provided the stated
-conditions are met. This License explicitly affirms your unlimited
-permission to run the unmodified Program. The output from running a
-covered work is covered by this License only if the output, given its
-content, constitutes a covered work. This License acknowledges your
-rights of fair use or other equivalent, as provided by copyright law.
-
-You may make, run and propagate covered works that you do not
-convey, without conditions so long as your license otherwise remains
-in force. You may convey covered works to others for the sole purpose
-of having them make modifications exclusively for you, or provide you
-with facilities for running those works, provided that you comply with
-the terms of this License in conveying all material for which you do
-not control copyright. Those thus making or running the covered works
-for you must do so exclusively on your behalf, under your direction
-and control, on terms that prohibit them from making any copies of
-your copyrighted material outside their relationship with you.
-
-Conveying under any other circumstances is permitted solely under
-the conditions stated below. Sublicensing is not allowed; section 10
-makes it unnecessary.
-
-3. Protecting Users' Legal Rights From Anti-Circumvention Law.
-
-No covered work shall be deemed part of an effective technological
-measure under any applicable law fulfilling obligations under article
-11 of the WIPO copyright treaty adopted on 20 December 1996, or
-similar laws prohibiting or restricting circumvention of such
-measures.
-
-When you convey a covered work, you waive any legal power to forbid
-circumvention of technological measures to the extent such circumvention
-is effected by exercising rights under this License with respect to
-the covered work, and you disclaim any intention to limit operation or
-modification of the work as a means of enforcing, against the work's
-users, your or third parties' legal rights to forbid circumvention of
-technological measures.
-
-4. Conveying Verbatim Copies.
-
-You may convey verbatim copies of the Program's source code as you
-receive it, in any medium, provided that you conspicuously and
-appropriately publish on each copy an appropriate copyright notice;
-keep intact all notices stating that this License and any
-non-permissive terms added in accord with section 7 apply to the code;
-keep intact all notices of the absence of any warranty; and give all
-recipients a copy of this License along with the Program.
-
-You may charge any price or no price for each copy that you convey,
-and you may offer support or warranty protection for a fee.
-
-5. Conveying Modified Source Versions.
-
-You may convey a work based on the Program, or the modifications to
-produce it from the Program, in the form of source code under the
-terms of section 4, provided that you also meet all of these conditions:
-
- a) The work must carry prominent notices stating that you modified
- it, and giving a relevant date.
-
- b) The work must carry prominent notices stating that it is
- released under this License and any conditions added under section
- 7. This requirement modifies the requirement in section 4 to
- "keep intact all notices".
-
- c) You must license the entire work, as a whole, under this
- License to anyone who comes into possession of a copy. This
- License will therefore apply, along with any applicable section 7
- additional terms, to the whole of the work, and all its parts,
- regardless of how they are packaged. This License gives no
- permission to license the work in any other way, but it does not
- invalidate such permission if you have separately received it.
-
- d) If the work has interactive user interfaces, each must display
- Appropriate Legal Notices; however, if the Program has interactive
- interfaces that do not display Appropriate Legal Notices, your
- work need not make them do so.
-
-A compilation of a covered work with other separate and independent
-works, which are not by their nature extensions of the covered work,
-and which are not combined with it such as to form a larger program,
-in or on a volume of a storage or distribution medium, is called an
-"aggregate" if the compilation and its resulting copyright are not
-used to limit the access or legal rights of the compilation's users
-beyond what the individual works permit. Inclusion of a covered work
-in an aggregate does not cause this License to apply to the other
-parts of the aggregate.
-
-6. Conveying Non-Source Forms.
-
-You may convey a covered work in object code form under the terms
-of sections 4 and 5, provided that you also convey the
-machine-readable Corresponding Source under the terms of this License,
-in one of these ways:
-
- a) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by the
- Corresponding Source fixed on a durable physical medium
- customarily used for software interchange.
-
- b) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by a
- written offer, valid for at least three years and valid for as
- long as you offer spare parts or customer support for that product
- model, to give anyone who possesses the object code either (1) a
- copy of the Corresponding Source for all the software in the
- product that is covered by this License, on a durable physical
- medium customarily used for software interchange, for a price no
- more than your reasonable cost of physically performing this
- conveying of source, or (2) access to copy the
- Corresponding Source from a network server at no charge.
-
- c) Convey individual copies of the object code with a copy of the
- written offer to provide the Corresponding Source. This
- alternative is allowed only occasionally and noncommercially, and
- only if you received the object code with such an offer, in accord
- with subsection 6b.
-
- d) Convey the object code by offering access from a designated
- place (gratis or for a charge), and offer equivalent access to the
- Corresponding Source in the same way through the same place at no
- further charge. You need not require recipients to copy the
- Corresponding Source along with the object code. If the place to
- copy the object code is a network server, the Corresponding Source
- may be on a different server (operated by you or a third party)
- that supports equivalent copying facilities, provided you maintain
- clear directions next to the object code saying where to find the
- Corresponding Source. Regardless of what server hosts the
- Corresponding Source, you remain obligated to ensure that it is
- available for as long as needed to satisfy these requirements.
-
- e) Convey the object code using peer-to-peer transmission, provided
- you inform other peers where the object code and Corresponding
- Source of the work are being offered to the general public at no
- charge under subsection 6d.
-
-A separable portion of the object code, whose source code is excluded
-from the Corresponding Source as a System Library, need not be
-included in conveying the object code work.
-
-A "User Product" is either (1) a "consumer product", which means any
-tangible personal property which is normally used for personal, family,
-or household purposes, or (2) anything designed or sold for incorporation
-into a dwelling. In determining whether a product is a consumer product,
-doubtful cases shall be resolved in favor of coverage. For a particular
-product received by a particular user, "normally used" refers to a
-typical or common use of that class of product, regardless of the status
-of the particular user or of the way in which the particular user
-actually uses, or expects or is expected to use, the product. A product
-is a consumer product regardless of whether the product has substantial
-commercial, industrial or non-consumer uses, unless such uses represent
-the only significant mode of use of the product.
-
-"Installation Information" for a User Product means any methods,
-procedures, authorization keys, or other information required to install
-and execute modified versions of a covered work in that User Product from
-a modified version of its Corresponding Source. The information must
-suffice to ensure that the continued functioning of the modified object
-code is in no case prevented or interfered with solely because
-modification has been made.
-
-If you convey an object code work under this section in, or with, or
-specifically for use in, a User Product, and the conveying occurs as
-part of a transaction in which the right of possession and use of the
-User Product is transferred to the recipient in perpetuity or for a
-fixed term (regardless of how the transaction is characterized), the
-Corresponding Source conveyed under this section must be accompanied
-by the Installation Information. But this requirement does not apply
-if neither you nor any third party retains the ability to install
-modified object code on the User Product (for example, the work has
-been installed in ROM).
-
-The requirement to provide Installation Information does not include a
-requirement to continue to provide support service, warranty, or updates
-for a work that has been modified or installed by the recipient, or for
-the User Product in which it has been modified or installed. Access to a
-network may be denied when the modification itself materially and
-adversely affects the operation of the network or violates the rules and
-protocols for communication across the network.
-
-Corresponding Source conveyed, and Installation Information provided,
-in accord with this section must be in a format that is publicly
-documented (and with an implementation available to the public in
-source code form), and must require no special password or key for
-unpacking, reading or copying.
-
-7. Additional Terms.
-
-"Additional permissions" are terms that supplement the terms of this
-License by making exceptions from one or more of its conditions.
-Additional permissions that are applicable to the entire Program shall
-be treated as though they were included in this License, to the extent
-that they are valid under applicable law. If additional permissions
-apply only to part of the Program, that part may be used separately
-under those permissions, but the entire Program remains governed by
-this License without regard to the additional permissions.
-
-When you convey a copy of a covered work, you may at your option
-remove any additional permissions from that copy, or from any part of
-it. (Additional permissions may be written to require their own
-removal in certain cases when you modify the work.) You may place
-additional permissions on material, added by you to a covered work,
-for which you have or can give appropriate copyright permission.
-
-Notwithstanding any other provision of this License, for material you
-add to a covered work, you may (if authorized by the copyright holders of
-that material) supplement the terms of this License with terms:
-
- a) Disclaiming warranty or limiting liability differently from the
- terms of sections 15 and 16 of this License; or
-
- b) Requiring preservation of specified reasonable legal notices or
- author attributions in that material or in the Appropriate Legal
- Notices displayed by works containing it; or
-
- c) Prohibiting misrepresentation of the origin of that material, or
- requiring that modified versions of such material be marked in
- reasonable ways as different from the original version; or
-
- d) Limiting the use for publicity purposes of names of licensors or
- authors of the material; or
-
- e) Declining to grant rights under trademark law for use of some
- trade names, trademarks, or service marks; or
-
- f) Requiring indemnification of licensors and authors of that
- material by anyone who conveys the material (or modified versions of
- it) with contractual assumptions of liability to the recipient, for
- any liability that these contractual assumptions directly impose on
- those licensors and authors.
-
-All other non-permissive additional terms are considered "further
-restrictions" within the meaning of section 10. If the Program as you
-received it, or any part of it, contains a notice stating that it is
-governed by this License along with a term that is a further
-restriction, you may remove that term. If a license document contains
-a further restriction but permits relicensing or conveying under this
-License, you may add to a covered work material governed by the terms
-of that license document, provided that the further restriction does
-not survive such relicensing or conveying.
-
-If you add terms to a covered work in accord with this section, you
-must place, in the relevant source files, a statement of the
-additional terms that apply to those files, or a notice indicating
-where to find the applicable terms.
-
-Additional terms, permissive or non-permissive, may be stated in the
-form of a separately written license, or stated as exceptions;
-the above requirements apply either way.
-
-8. Termination.
-
-You may not propagate or modify a covered work except as expressly
-provided under this License. Any attempt otherwise to propagate or
-modify it is void, and will automatically terminate your rights under
-this License (including any patent licenses granted under the third
-paragraph of section 11).
-
-However, if you cease all violation of this License, then your
-license from a particular copyright holder is reinstated (a)
-provisionally, unless and until the copyright holder explicitly and
-finally terminates your license, and (b) permanently, if the copyright
-holder fails to notify you of the violation by some reasonable means
-prior to 60 days after the cessation.
-
-Moreover, your license from a particular copyright holder is
-reinstated permanently if the copyright holder notifies you of the
-violation by some reasonable means, this is the first time you have
-received notice of violation of this License (for any work) from that
-copyright holder, and you cure the violation prior to 30 days after
-your receipt of the notice.
-
-Termination of your rights under this section does not terminate the
-licenses of parties who have received copies or rights from you under
-this License. If your rights have been terminated and not permanently
-reinstated, you do not qualify to receive new licenses for the same
-material under section 10.
-
-9. Acceptance Not Required for Having Copies.
-
-You are not required to accept this License in order to receive or
-run a copy of the Program. Ancillary propagation of a covered work
-occurring solely as a consequence of using peer-to-peer transmission
-to receive a copy likewise does not require acceptance. However,
-nothing other than this License grants you permission to propagate or
-modify any covered work. These actions infringe copyright if you do
-not accept this License. Therefore, by modifying or propagating a
-covered work, you indicate your acceptance of this License to do so.
-
-10. Automatic Licensing of Downstream Recipients.
-
-Each time you convey a covered work, the recipient automatically
-receives a license from the original licensors, to run, modify and
-propagate that work, subject to this License. You are not responsible
-for enforcing compliance by third parties with this License.
-
-An "entity transaction" is a transaction transferring control of an
-organization, or substantially all assets of one, or subdividing an
-organization, or merging organizations. If propagation of a covered
-work results from an entity transaction, each party to that
-transaction who receives a copy of the work also receives whatever
-licenses to the work the party's predecessor in interest had or could
-give under the previous paragraph, plus a right to possession of the
-Corresponding Source of the work from the predecessor in interest, if
-the predecessor has it or can get it with reasonable efforts.
-
-You may not impose any further restrictions on the exercise of the
-rights granted or affirmed under this License. For example, you may
-not impose a license fee, royalty, or other charge for exercise of
-rights granted under this License, and you may not initiate litigation
-(including a cross-claim or counterclaim in a lawsuit) alleging that
-any patent claim is infringed by making, using, selling, offering for
-sale, or importing the Program or any portion of it.
-
-11. Patents.
-
-A "contributor" is a copyright holder who authorizes use under this
-License of the Program or a work on which the Program is based. The
-work thus licensed is called the contributor's "contributor version".
-
-A contributor's "essential patent claims" are all patent claims
-owned or controlled by the contributor, whether already acquired or
-hereafter acquired, that would be infringed by some manner, permitted
-by this License, of making, using, or selling its contributor version,
-but do not include claims that would be infringed only as a
-consequence of further modification of the contributor version. For
-purposes of this definition, "control" includes the right to grant
-patent sublicenses in a manner consistent with the requirements of
-this License.
-
-Each contributor grants you a non-exclusive, worldwide, royalty-free
-patent license under the contributor's essential patent claims, to
-make, use, sell, offer for sale, import and otherwise run, modify and
-propagate the contents of its contributor version.
-
-In the following three paragraphs, a "patent license" is any express
-agreement or commitment, however denominated, not to enforce a patent
-(such as an express permission to practice a patent or covenant not to
-sue for patent infringement). To "grant" such a patent license to a
-party means to make such an agreement or commitment not to enforce a
-patent against the party.
-
-If you convey a covered work, knowingly relying on a patent license,
-and the Corresponding Source of the work is not available for anyone
-to copy, free of charge and under the terms of this License, through a
-publicly available network server or other readily accessible means,
-then you must either (1) cause the Corresponding Source to be so
-available, or (2) arrange to deprive yourself of the benefit of the
-patent license for this particular work, or (3) arrange, in a manner
-consistent with the requirements of this License, to extend the patent
-license to downstream recipients. "Knowingly relying" means you have
-actual knowledge that, but for the patent license, your conveying the
-covered work in a country, or your recipient's use of the covered work
-in a country, would infringe one or more identifiable patents in that
-country that you have reason to believe are valid.
-
-If, pursuant to or in connection with a single transaction or
-arrangement, you convey, or propagate by procuring conveyance of, a
-covered work, and grant a patent license to some of the parties
-receiving the covered work authorizing them to use, propagate, modify
-or convey a specific copy of the covered work, then the patent license
-you grant is automatically extended to all recipients of the covered
-work and works based on it.
-
-A patent license is "discriminatory" if it does not include within
-the scope of its coverage, prohibits the exercise of, or is
-conditioned on the non-exercise of one or more of the rights that are
-specifically granted under this License. You may not convey a covered
-work if you are a party to an arrangement with a third party that is
-in the business of distributing software, under which you make payment
-to the third party based on the extent of your activity of conveying
-the work, and under which the third party grants, to any of the
-parties who would receive the covered work from you, a discriminatory
-patent license (a) in connection with copies of the covered work
-conveyed by you (or copies made from those copies), or (b) primarily
-for and in connection with specific products or compilations that
-contain the covered work, unless you entered into that arrangement,
-or that patent license was granted, prior to 28 March 2007.
-
-Nothing in this License shall be construed as excluding or limiting
-any implied license or other defenses to infringement that may
-otherwise be available to you under applicable patent law.
-
-12. No Surrender of Others' Freedom.
-
-If conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot convey a
-covered work so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you may
-not convey it at all. For example, if you agree to terms that obligate you
-to collect a royalty for further conveying from those to whom you convey
-the Program, the only way you could satisfy both those terms and this
-License would be to refrain entirely from conveying the Program.
-
-13. Use with the GNU Affero General Public License.
-
-Notwithstanding any other provision of this License, you have
-permission to link or combine any covered work with a work licensed
-under version 3 of the GNU Affero General Public License into a single
-combined work, and to convey the resulting work. The terms of this
-License will continue to apply to the part which is the covered work,
-but the special requirements of the GNU Affero General Public License,
-section 13, concerning interaction through a network will apply to the
-combination as such.
-
-14. Revised Versions of this License.
-
-The Free Software Foundation may publish revised and/or new versions of
-the GNU General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number. If the
-Program specifies that a certain numbered version of the GNU General
-Public License "or any later version" applies to it, you have the
-option of following the terms and conditions either of that numbered
-version or of any later version published by the Free Software
-Foundation. If the Program does not specify a version number of the
-GNU General Public License, you may choose any version ever published
-by the Free Software Foundation.
-
-If the Program specifies that a proxy can decide which future
-versions of the GNU General Public License can be used, that proxy's
-public statement of acceptance of a version permanently authorizes you
-to choose that version for the Program.
-
-Later license versions may give you additional or different
-permissions. However, no additional obligations are imposed on any
-author or copyright holder as a result of your choosing to follow a
-later version.
-
-15. Disclaimer of Warranty.
-
-THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
-APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
-HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
-OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
-IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
-ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
-16. Limitation of Liability.
-
-IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
-THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
-GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
-USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
-DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
-PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
-EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGES.
-
-17. Interpretation of Sections 15 and 16.
-
-If the disclaimer of warranty and limitation of liability provided
-above cannot be given local legal effect according to their terms,
-reviewing courts shall apply local law that most closely approximates
-an absolute waiver of all civil liability in connection with the
-Program, unless a warranty or assumption of liability accompanies a
-copy of the Program in return for a fee.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
-If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
-To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-state the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
- Wayback Tweets - Tool that displays, via Wayback CDX Server API, multiple archived tweets on Wayback Machine to avoid opening each link manually.
- Copyright (C) 2023 Clarissa Mendes (Claromes)
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <https://www.gnu.org/licenses/>.
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program does terminal interaction, make it output a short
-notice like this when it starts in an interactive mode:
-
- Wayback Tweets Copyright (C) 2023 Clarissa Mendes (Claromes)
- This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, your program's commands
-might be different; for a GUI interface, you would use an "about box".
-
-You should also get your employer (if you work as a programmer) or school,
-if any, to sign a "copyright disclaimer" for the program, if necessary.
-For more information on this, and how to apply and follow the GNU GPL, see
-<https://www.gnu.org/licenses/>.
-
-The GNU General Public License does not permit incorporating your program
-into proprietary programs. If your program is a subroutine library, you
-may consider it more useful to permit linking proprietary applications with
-the library. If this is what you want to do, use the GNU Lesser General
-Public License instead of this License. But first, please read
-<https://www.gnu.org/licenses/why-not-lgpl.html>.
--- /dev/null
+@ECHO OFF\r
+\r
+pushd %~dp0\r
+\r
+REM Command file for Sphinx documentation\r
+\r
+if "%SPHINXBUILD%" == "" (\r
+ set SPHINXBUILD=sphinx-build\r
+)\r
+set SOURCEDIR=.\r
+set BUILDDIR=_build\r
+\r
+%SPHINXBUILD% >NUL 2>NUL\r
+if errorlevel 9009 (\r
+ echo.\r
+ echo.The 'sphinx-build' command was not found. Make sure you have Sphinx\r
+ echo.installed, then set the SPHINXBUILD environment variable to point\r
+ echo.to the full path of the 'sphinx-build' executable. Alternatively you\r
+ echo.may add the Sphinx directory to PATH.\r
+ echo.\r
+ echo.If you don't have Sphinx installed, grab it from\r
+ echo.https://www.sphinx-doc.org/\r
+ exit /b 1\r
+)\r
+\r
+if "%1" == "" goto help\r
+\r
+%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%\r
+goto end\r
+\r
+:help\r
+%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%\r
+\r
+:end\r
+popd\r
--- /dev/null
+waybacktweets
+=============
+
+.. toctree::
+ :maxdepth: 4
+
+ api
--- /dev/null
+Quick Start
+================
+
+CLI
+-------------
+
+Using Wayback Tweets as a standalone command line tool
+
+wbt [OPTIONS] USERNAME
+
+$ ``wbt --from 2015-01-01 --to 2019-12-31 --limit 250 jack``
+
+
+Module
+-------------
+
+Using Wayback Tweets as a Python Module
+
+.. code-block:: python
+
+ from waybacktweets import WaybackTweets
+ from waybacktweets.utils import parse_date
+
+ username = "jack"
+ collapse = "urlkey"
+ timestamp_from = parse_date("2015-01-01")
+ timestamp_to = parse_date("2019-12-31")
+ limit = 250
+ offset = 0
+
+ api = WaybackTweets(username, collapse, timestamp_from, timestamp_to, limit, offset)
+ archived_tweets = api.get()
--- /dev/null
+Result
+================
+
+The package saves in three formats: CSV, JSON, and HTML. The files have the following fields:
+
+- ``archived_urlkey``: (`str`) A canonical transformation of the URL you supplied, for example, ``org,eserver,tc)/``. Such keys are useful for indexing.
+
+- ``archived_timestamp``: (`datetime`) A 14 digit date-time representation in the ``YYYYMMDDhhmmss`` format.
+
+- ``original_tweet_url``: (`str`) The original tweet URL.
+
+- ``archived_tweet_url``: (`str`) The original archived URL.
+
+- ``parsed_tweet_url``: (`str`) The original tweet URL after parsing. `Check the utility functions <api.html#module-waybacktweets.utils.utils>`_.
+
+- ``parsed_archived_tweet_url``: (`str`) The original archived URL after parsing. `Check the utility functions <api.html#module-waybacktweets.utils.utils>`_.
+
+- ``parsed_tweet_text_mimetype_json``: (`str`) The tweet text extracted from the archived URL that has mimetype ``application/json``.
+
+- ``available_tweet_text``: (`str`) The tweet text extracted from the URL that is still available on the Twitter account.
+
+- ``available_tweet_is_RT``: (`bool`) Whether the tweet from the ``available_tweet_text`` field is a retweet or not.
+
+- ``available_tweet_info``: (`str`) Name and date of the tweet from the ``available_tweet_text`` field.
+
+- ``archived_mimetype``: (`str`) The mimetype of the archived content, which can be one of these:
+
+ - ``text/html``
+
+ - ``warc/revisit``
+
+ - ``application/json``
+
+ - ``unk``
+
+- ``archived_statuscode``: (`str`) The HTTP status code of the snapshot. If the mimetype is ``warc/revisit``, the value returned for the ``statuscode`` key can be blank, but the actual value is the same as that of any other entry that has the same ``digest`` as this entry. If the mimetype is ``application/json``, the value is usually empty or ``-``.
+
+- ``archived_digest``: (`str`) The ``SHA1`` hash digest of the content, excluding the headers. It's usually a base-32-encoded string.
+
+- ``archived_length``: (`int`) The compressed byte size of the corresponding WARC record, which includes WARC headers, HTTP headers, and content payload.
--- /dev/null
+Web App
+=========
+
+Aplication that displays multiple archived tweets on Wayback Machine to avoid opening each link manually. The application is a prototype written in Python with the Streamlit framework and hosted on Streamlit Cloud, allowing users to apply filters and view tweets that lack the original URL.
+
+
+Filters
+----------
+
+- Calendar: Filtering by date range
+
+- Checkbox: Only tweets not available
+
+- Checkbox: Only unique URLs (filtering by the collapse option using the urlkey field)
+
+
+Pagination
+------------
+
+Pagination is automatic and allows viewing up to 25 tweets per page. This is a fixed value due to the API rate limit.
+
+
+Community Comments
+--------------------
+
+.. raw:: html
+
+ <ul>
+ <li>"We're always delighted when we see our community members create tools for open source research." <a href="https://twitter.com/bellingcat/status/1728085974138122604" target="_blank">Bellingcat</a></li>
+ <br>
+ <li>"#myOSINTtip Clarissa Mendes launched a new tool for accessing old tweets via archive.org called the Wayback Tweets app. For those who love to look deeper at #osint tools, it is available on GitHub and uses the Wayback CDX Server API server (which is a hidden gem for accessing archive.org data!)" <a href="https://www.linkedin.com/posts/my-osint-training_myosinttip-osint-activity-7148425933324963841-0Q2n/" target="_blank">My OSINT Training</a></li>
+ <br>
+ <li>"Original way to find deleted tweets." <a href="https://twitter.com/henkvaness/status/1693298101765701676" target="_blank">Henk Van Ess</a></li>
+ <br>
+ <li>"This is an excellent tool to use now that most Twitter API-based tools have gone down with changes to the pricing structure over at X." <a href="https://osintnewsletter.com/p/22#%C2%A7osint-community" target="_blank">The OSINT Newsletter - Issue #22</a></li>
+ <br>
+ <li>"One of the keys to using the Wayback Machine effectively is knowing what it can and can't archive. It can, and has, archived many, many Twitter accounts... Utilize fun tools such as Wayback Tweets to do so more effectively." <a href="https://memeticwarfareweekly.substack.com/p/mww-paradise-by-the-telegram-dashboard" target="_blank">Ari Ben Am</a></li>
+ <br>
+ <li>"Want to see archived tweets on Wayback Machine in bulk? You can use Wayback Tweets." <a href="https://twitter.com/DailyOsint/status/1695065018662855102" target="_blank">Daily OSINT</a></li>
+ <br>
+ <li>"Untuk mempermudah penelusuran arsip, gunakan Wayback Tweets." <a href="https://twitter.com/gijnIndonesia/status/1685912219408805888" target="_blank">GIJN Indonesia</a></li>
+ <br>
+ <li>"A tool to quickly view tweets saved on archive.org." <a href="https://irinatechtips.substack.com/p/irina_tech_tips-newsletter-3-2023#%C2%A7wayback-tweets" target="_blank">Irina_Tech_Tips Newsletter #3</a></li>
+ <br>
+ </ul>
+
+.. note::
+
+ If the application is down, please check the `Streamlit Cloud Status <https://www.streamlitstatus.com/>`_.
+
+++ /dev/null
-/* Increase the logo in the header */
-.md-header__button.md-logo img, .md-header__button.md-logo img {
- height: 2.2rem;
-}
-
-/* Center the logo on the home page */
-.logo-center {
- display: block;
- margin: auto;
-}
-
-/* Adjust the icons*/
-.md-social__link svg, .md-source__icon svg, .magnifyingglass {
- fill: none !important;
- max-height: none;
-}
-
-.magnifyingglass {
- scale: 1.2;
-}
-
-.md-source__icon svg {
- scale: 1.5;
-}
-
-.md-social__link svg:hover {
- opacity: .6;
-}
-
-.md-social a:last-child {
- margin-left: -8px;
-}
--- /dev/null
+Workflow
+================
+
+The tool was written following a proposal not only to Retrieve data from archived tweets, but also to facilitate the reading of these tweets. Therefore, a flow is defined to obtain these results in the best possible way.
+
+Due to limitations of the Wayback CDX Server API, it is not always possible to parse the results with the mimetype ``application/json``, regardless, the data in CDX format are saved.
+
+Use the mouse to zoom in and out the flowchart.
+
+.. mermaid::
+ :zoom:
+ :align: center
+
+ flowchart TB
+ A[input Username]--> B[(Wayback Machine)]
+ B--> B1[save Archived Tweets CDX data]
+ B1--> |parsing| C{embed Tweet URL\nvia Twitter Publisher}
+ C--> |2xx/3xx| D[return Tweet text]
+ C--> |4xx| E[return None]
+ E--> F{request Archived\nTweet URL}
+ F--> |4xx| G[return Only CDX data]
+ F--> |2xx/3xx: application/json| J[return JSON text]
+ F--> |2xx/3xx: text/html, warc/revisit, unk| K[return HTML iframe tag]
+++ /dev/null
-<svg width="400" height="400" viewBox="0 0 550 400" fill="none" xmlns="http://www.w3.org/2000/svg">
-<path d="M179.222 296.039C171.929 321.836 117.118 349.829 100.868 317.327C83.9601 283.513 128.707 258.291 155.272 253.461" stroke="white" stroke-opacity="0.9" stroke-width="16" stroke-linecap="round" stroke-linejoin="round"/>
-<path d="M154.089 255.235C140.063 256.692 126.178 245.826 114.468 239.268C74.9513 217.139 49.2305 174.06 54.7419 127.208C60.5666 77.6967 120.975 104.935 142.262 123.068C160.693 138.769 174.617 160.101 184.839 181.908C193.152 199.64 200.112 214.666 205.536 233.651" stroke="white" stroke-opacity="0.9" stroke-width="16" stroke-linecap="round" stroke-linejoin="round"/>
-<path d="M211.746 221.528C216.22 203.929 220.6 185.643 227.417 168.602C234.927 149.827 243.612 130.546 256.097 114.494C267.281 100.115 309.676 53.8821 331.79 73.9865C338.609 80.1856 341.437 92.7089 343.321 101.189C355.43 155.676 303.486 234.412 246.044 240.156" stroke="white" stroke-opacity="0.9" stroke-width="16" stroke-linecap="round" stroke-linejoin="round"/>
-<path d="M249.001 238.972C282.8 227.116 321.478 272.606 305.179 305.204C286.258 343.046 248.409 334.476 215.589 283.62" stroke="white" stroke-opacity="0.9" stroke-width="16" stroke-linecap="round" stroke-linejoin="round"/>
-<path d="M205.537 171.56C213.34 215.845 203.3 268.936 199.919 312.892" stroke="white" stroke-opacity="0.9" stroke-width="16" stroke-linecap="round" stroke-linejoin="round"/>
-</svg>
+++ /dev/null
-<svg width="400" height="400" viewBox="0 0 400 400" fill="none" xmlns="http://www.w3.org/2000/svg">
-<path d="M95.0156 245.407C97.9365 205.849 97.9365 171.749 95.0156 143.106C225.305 134.501 293.881 132.995 300.742 138.588C306.4 143.206 304.238 261.692 297.623 261.692C238.015 261.692 172.551 258.45 113.287 265.61" stroke="white" stroke-width="16" stroke-linecap="round" stroke-linejoin="round"/>
-<path d="M102.731 146.11C222.913 221.359 180.287 215.896 293.29 144.971" stroke="white" stroke-width="16" stroke-linecap="round" stroke-linejoin="round"/>
-<path opacity="0.503384" d="M174.457 191.148C151.534 203.743 138.346 230.337 117.717 245.407" stroke="white" stroke-width="16" stroke-linecap="round" stroke-linejoin="round"/>
-<path opacity="0.503384" d="M230.126 191.148C247.126 207.11 266.491 218.278 284.724 238.48" stroke="white" stroke-width="16" stroke-linecap="round" stroke-linejoin="round"/>
-</svg>
+++ /dev/null
-<svg class="magnifyingglass" width="400" height="400" viewBox="0 0 400 400" fill="none" xmlns="http://www.w3.org/2000/svg">
-<path d="M197.001 244C171.822 271.83 126.998 313 104.256 295.496C81.5174 277.992 126.998 246 156.656 220.314" stroke="white" stroke-opacity="0.9" stroke-width="16" stroke-linecap="round" stroke-linejoin="round"/>
-<path d="M165.944 196.347C135.998 107 276.999 75.9996 300.776 165.974C319.017 235 211.46 292.164 175.314 213.85" stroke="white" stroke-opacity="0.9" stroke-width="16" stroke-linecap="round" stroke-linejoin="round"/>
-</svg>
+++ /dev/null
-<svg width="400" height="500" viewBox="0 0 500 450" fill="none" xmlns="http://www.w3.org/2000/svg">
-<path d="M209.465 110.279C220.844 102.045 243.633 94.2471 255.438 110.516C285.622 152.116 284.68 173.999 287.015 208.667C288.113 224.973 292.339 246.962 287.943 262.918C283.273 279.872 269.757 288.283 257.759 271.653" stroke="white" stroke-opacity="0.9" stroke-width="16" stroke-linecap="round" stroke-linejoin="round"/>
-<path d="M251.381 191.157C278.056 247.054 339.746 238.92 339.746 173.777" stroke="white" stroke-opacity="0.9" stroke-width="16" stroke-linecap="round" stroke-linejoin="round"/>
-<path d="M294.432 231.675C336.072 269.434 398.361 203.922 367.899 179.463" stroke="white" stroke-opacity="0.9" stroke-width="16" stroke-linecap="round" stroke-linejoin="round"/>
-<path d="M206.066 114.014C174.216 98.71 91.0492 131.615 68.1095 154.649C57.6834 165.119 49.289 177.547 43.2776 191.128C28.8463 223.733 41.6566 259.758 34.9999 293.177" stroke="white" stroke-opacity="0.9" stroke-width="16" stroke-linecap="round" stroke-linejoin="round"/>
-<path d="M217.926 201.068C228.543 233.018 211.588 268.862 221.926 300" stroke="white" stroke-opacity="0.9" stroke-width="16" stroke-linecap="round" stroke-linejoin="round"/>
-<path d="M172.838 246.555C179.732 262.829 170.947 280.086 170.947 295.452" stroke="white" stroke-opacity="0.9" stroke-width="16" stroke-linecap="round" stroke-linejoin="round"/>
-<path d="M167.547 247.691C145.242 259.866 123.942 248.701 101.839 248.701" stroke="white" stroke-opacity="0.9" stroke-width="16" stroke-linecap="round" stroke-linejoin="round"/>
-<path d="M99.4025 188.56C107.731 228.089 73.5196 259.74 73.5196 297.725" stroke="white" stroke-opacity="0.9" stroke-width="16" stroke-linecap="round" stroke-linejoin="round"/>
-<path d="M117.703 257.926C119.187 270.742 121.531 283.526 125.633 295.451" stroke="white" stroke-opacity="0.9" stroke-width="16" stroke-linecap="round" stroke-linejoin="round"/>
-<path d="M251.461 168.092C251.357 165.329 251.132 162.747 252.514 160.132" stroke="white" stroke-opacity="0.9" stroke-width="16" stroke-linecap="round" stroke-linejoin="round"/>
-</svg>
+++ /dev/null
-<svg width="400" height="400" viewBox="0 0 400 400" fill="none" xmlns="http://www.w3.org/2000/svg">
-<path d="M89 291.829C136.178 351.39 120.825 251.8 131.321 234.688C140.473 219.763 168.426 226.711 171.721 206.889C177.405 172.654 133.482 157.233 189.418 101.103C197.701 92.7912 209.668 86.6025 221.737 89.9054C280.646 106.029 231.398 181.8 234.817 212.68C237.06 232.929 280.175 207.964 286.758 250.902C288.166 260.074 288.267 319.567 310.614 306.112" stroke="white" stroke-opacity="0.9" stroke-width="16" stroke-linecap="round" stroke-linejoin="round"/>
-<path d="M180.818 241.289C197.31 262.581 151.352 274.541 171.482 300.386" stroke="white" stroke-opacity="0.9" stroke-width="16" stroke-linecap="round" stroke-linejoin="round"/>
-<path d="M208.33 237.879C209.788 263.541 217.552 279.329 208.717 306.068" stroke="white" stroke-opacity="0.9" stroke-width="16" stroke-linecap="round" stroke-linejoin="round"/>
-<path d="M236.742 248.165C276.468 246.211 234.958 294.947 257.199 306.068" stroke="white" stroke-opacity="0.9" stroke-width="16" stroke-linecap="round" stroke-linejoin="round"/>
-<path d="M226.73 156.053C227.429 153.522 227.198 150.751 227.433 148.098" stroke="white" stroke-opacity="0.9" stroke-width="16" stroke-linecap="round" stroke-linejoin="round"/>
-<path d="M205.816 156.053C206.412 153.077 206.282 150.035 206.282 146.961" stroke="white" stroke-opacity="0.9" stroke-width="16" stroke-linecap="round" stroke-linejoin="round"/>
-</svg>
# This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand.
+[[package]]
+name = "alabaster"
+version = "0.7.16"
+description = "A light, configurable Sphinx theme"
+optional = false
+python-versions = ">=3.9"
+files = [
+ {file = "alabaster-0.7.16-py3-none-any.whl", hash = "sha256:b46733c07dce03ae4e150330b975c75737fa60f0a7c591b6c8bf4928a28e2c92"},
+ {file = "alabaster-0.7.16.tar.gz", hash = "sha256:75a8b99c28a5dad50dd7f8ccdd447a121ddb3892da9e53d1ca5cca3106d58d65"},
+]
+
[[package]]
name = "altair"
version = "5.3.0"
{file = "distlib-0.3.8.tar.gz", hash = "sha256:1530ea13e350031b6312d8580ddb6b27a104275a31106523b8f123787f494f64"},
]
+[[package]]
+name = "docutils"
+version = "0.21.2"
+description = "Docutils -- Python Documentation Utilities"
+optional = false
+python-versions = ">=3.9"
+files = [
+ {file = "docutils-0.21.2-py3-none-any.whl", hash = "sha256:dafca5b9e384f0e419294eb4d2ff9fa826435bf15f15b7bd45723e8ad76811b2"},
+ {file = "docutils-0.21.2.tar.gz", hash = "sha256:3a6b18732edf182daa3cd12775bbb338cf5691468f91eeeb109deff6ebfa986f"},
+]
+
[[package]]
name = "exceptiongroup"
version = "1.2.1"
[[package]]
name = "filelock"
-version = "3.14.0"
+version = "3.15.1"
description = "A platform independent file lock."
optional = false
python-versions = ">=3.8"
files = [
- {file = "filelock-3.14.0-py3-none-any.whl", hash = "sha256:43339835842f110ca7ae60f1e1c160714c5a6afd15a2873419ab185334975c0f"},
- {file = "filelock-3.14.0.tar.gz", hash = "sha256:6ea72da3be9b8c82afd3edcf99f2fffbb5076335a5ae4d03248bb5b6c3eae78a"},
+ {file = "filelock-3.15.1-py3-none-any.whl", hash = "sha256:71b3102950e91dfc1bb4209b64be4dc8854f40e5f534428d8684f953ac847fac"},
+ {file = "filelock-3.15.1.tar.gz", hash = "sha256:58a2549afdf9e02e10720eaa4d4470f56386d7a6f72edd7d0596337af8ed7ad8"},
]
[package.extras]
docs = ["furo (>=2023.9.10)", "sphinx (>=7.2.6)", "sphinx-autodoc-typehints (>=1.25.2)"]
-testing = ["covdefaults (>=2.3)", "coverage (>=7.3.2)", "diff-cover (>=8.0.1)", "pytest (>=7.4.3)", "pytest-cov (>=4.1)", "pytest-mock (>=3.12)", "pytest-timeout (>=2.2)"]
+testing = ["covdefaults (>=2.3)", "coverage (>=7.3.2)", "diff-cover (>=8.0.1)", "pytest (>=7.4.3)", "pytest-asyncio (>=0.21)", "pytest-cov (>=4.1)", "pytest-mock (>=3.12)", "pytest-timeout (>=2.2)"]
typing = ["typing-extensions (>=4.8)"]
[[package]]
[package.extras]
dev = ["pyTest", "pyTest-cov"]
-[[package]]
-name = "ghp-import"
-version = "2.1.0"
-description = "Copy your docs directly to the gh-pages branch."
-optional = false
-python-versions = "*"
-files = [
- {file = "ghp-import-2.1.0.tar.gz", hash = "sha256:9c535c4c61193c2df8871222567d7fd7e5014d835f97dc7b7439069e2413d343"},
- {file = "ghp_import-2.1.0-py3-none-any.whl", hash = "sha256:8337dd7b50877f163d4c0289bc1f1c7f127550241988d568c1db512c4324a619"},
-]
-
-[package.dependencies]
-python-dateutil = ">=2.8.1"
-
-[package.extras]
-dev = ["flake8", "markdown", "twine", "wheel"]
-
[[package]]
name = "gitdb"
version = "4.0.11"
{file = "idna-3.7.tar.gz", hash = "sha256:028ff3aadf0609c1fd278d8ea3089299412a7a8b9bd005dd08b9f8285bcb5cfc"},
]
+[[package]]
+name = "imagesize"
+version = "1.4.1"
+description = "Getting image size from png/jpeg/jpeg2000/gif file"
+optional = false
+python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
+files = [
+ {file = "imagesize-1.4.1-py2.py3-none-any.whl", hash = "sha256:0d8d18d08f840c19d0ee7ca1fd82490fdc3729b7ac93f49870406ddde8ef8d8b"},
+ {file = "imagesize-1.4.1.tar.gz", hash = "sha256:69150444affb9cb0d5cc5a92b3676f0b2fb7cd9ae39e947a5e11a36b4497cd4a"},
+]
+
[[package]]
name = "importlib-metadata"
version = "7.1.0"
[package.dependencies]
referencing = ">=0.31.0"
-[[package]]
-name = "markdown"
-version = "3.6"
-description = "Python implementation of John Gruber's Markdown."
-optional = false
-python-versions = ">=3.8"
-files = [
- {file = "Markdown-3.6-py3-none-any.whl", hash = "sha256:48f276f4d8cfb8ce6527c8f79e2ee29708508bf4d40aa410fbc3b4ee832c850f"},
- {file = "Markdown-3.6.tar.gz", hash = "sha256:ed4f41f6daecbeeb96e576ce414c41d2d876daa9a16cb35fa8ed8c2ddfad0224"},
-]
-
-[package.dependencies]
-importlib-metadata = {version = ">=4.4", markers = "python_version < \"3.10\""}
-
-[package.extras]
-docs = ["mdx-gh-links (>=0.2)", "mkdocs (>=1.5)", "mkdocs-gen-files", "mkdocs-literate-nav", "mkdocs-nature (>=0.6)", "mkdocs-section-index", "mkdocstrings[python]"]
-testing = ["coverage", "pyyaml"]
-
[[package]]
name = "markdown-it-py"
version = "3.0.0"
{file = "mdurl-0.1.2.tar.gz", hash = "sha256:bb413d29f5eea38f31dd4754dd7377d4465116fb207585f97bf925588687c1ba"},
]
-[[package]]
-name = "mergedeep"
-version = "1.3.4"
-description = "A deep merge function for 🐍."
-optional = false
-python-versions = ">=3.6"
-files = [
- {file = "mergedeep-1.3.4-py3-none-any.whl", hash = "sha256:70775750742b25c0d8f36c55aed03d24c3384d17c951b3175d898bd778ef0307"},
- {file = "mergedeep-1.3.4.tar.gz", hash = "sha256:0096d52e9dad9939c3d975a774666af186eda617e6ca84df4c94dec30004f2a8"},
-]
-
-[[package]]
-name = "mkdocs"
-version = "1.6.0"
-description = "Project documentation with Markdown."
-optional = false
-python-versions = ">=3.8"
-files = [
- {file = "mkdocs-1.6.0-py3-none-any.whl", hash = "sha256:1eb5cb7676b7d89323e62b56235010216319217d4af5ddc543a91beb8d125ea7"},
- {file = "mkdocs-1.6.0.tar.gz", hash = "sha256:a73f735824ef83a4f3bcb7a231dcab23f5a838f88b7efc54a0eef5fbdbc3c512"},
-]
-
-[package.dependencies]
-click = ">=7.0"
-colorama = {version = ">=0.4", markers = "platform_system == \"Windows\""}
-ghp-import = ">=1.0"
-importlib-metadata = {version = ">=4.4", markers = "python_version < \"3.10\""}
-jinja2 = ">=2.11.1"
-markdown = ">=3.3.6"
-markupsafe = ">=2.0.1"
-mergedeep = ">=1.3.4"
-mkdocs-get-deps = ">=0.2.0"
-packaging = ">=20.5"
-pathspec = ">=0.11.1"
-pyyaml = ">=5.1"
-pyyaml-env-tag = ">=0.1"
-watchdog = ">=2.0"
-
-[package.extras]
-i18n = ["babel (>=2.9.0)"]
-min-versions = ["babel (==2.9.0)", "click (==7.0)", "colorama (==0.4)", "ghp-import (==1.0)", "importlib-metadata (==4.4)", "jinja2 (==2.11.1)", "markdown (==3.3.6)", "markupsafe (==2.0.1)", "mergedeep (==1.3.4)", "mkdocs-get-deps (==0.2.0)", "packaging (==20.5)", "pathspec (==0.11.1)", "pyyaml (==5.1)", "pyyaml-env-tag (==0.1)", "watchdog (==2.0)"]
-
-[[package]]
-name = "mkdocs-get-deps"
-version = "0.2.0"
-description = "MkDocs extension that lists all dependencies according to a mkdocs.yml file"
-optional = false
-python-versions = ">=3.8"
-files = [
- {file = "mkdocs_get_deps-0.2.0-py3-none-any.whl", hash = "sha256:2bf11d0b133e77a0dd036abeeb06dec8775e46efa526dc70667d8863eefc6134"},
- {file = "mkdocs_get_deps-0.2.0.tar.gz", hash = "sha256:162b3d129c7fad9b19abfdcb9c1458a651628e4b1dea628ac68790fb3061c60c"},
-]
-
-[package.dependencies]
-importlib-metadata = {version = ">=4.3", markers = "python_version < \"3.10\""}
-mergedeep = ">=1.3.4"
-platformdirs = ">=2.2.0"
-pyyaml = ">=5.1"
-
-[[package]]
-name = "mkdocs-material"
-version = "9.5.26"
-description = "Documentation that simply works"
-optional = false
-python-versions = ">=3.8"
-files = [
- {file = "mkdocs_material-9.5.26-py3-none-any.whl", hash = "sha256:5d01fb0aa1c7946a1e3ae8689aa2b11a030621ecb54894e35aabb74c21016312"},
- {file = "mkdocs_material-9.5.26.tar.gz", hash = "sha256:56aeb91d94cffa43b6296fa4fbf0eb7c840136e563eecfd12c2d9e92e50ba326"},
-]
-
-[package.dependencies]
-babel = ">=2.10,<3.0"
-colorama = ">=0.4,<1.0"
-jinja2 = ">=3.0,<4.0"
-markdown = ">=3.2,<4.0"
-mkdocs = ">=1.6,<2.0"
-mkdocs-material-extensions = ">=1.3,<2.0"
-paginate = ">=0.5,<1.0"
-pygments = ">=2.16,<3.0"
-pymdown-extensions = ">=10.2,<11.0"
-regex = ">=2022.4"
-requests = ">=2.26,<3.0"
-
-[package.extras]
-git = ["mkdocs-git-committers-plugin-2 (>=1.1,<2.0)", "mkdocs-git-revision-date-localized-plugin (>=1.2.4,<2.0)"]
-imaging = ["cairosvg (>=2.6,<3.0)", "pillow (>=10.2,<11.0)"]
-recommended = ["mkdocs-minify-plugin (>=0.7,<1.0)", "mkdocs-redirects (>=1.2,<2.0)", "mkdocs-rss-plugin (>=1.6,<2.0)"]
-
-[[package]]
-name = "mkdocs-material-extensions"
-version = "1.3.1"
-description = "Extension pack for Python Markdown and MkDocs Material."
-optional = false
-python-versions = ">=3.8"
-files = [
- {file = "mkdocs_material_extensions-1.3.1-py3-none-any.whl", hash = "sha256:adff8b62700b25cb77b53358dad940f3ef973dd6db797907c49e3c2ef3ab4e31"},
- {file = "mkdocs_material_extensions-1.3.1.tar.gz", hash = "sha256:10c9511cea88f568257f960358a467d12b970e1f7b2c0e5fb2bb48cab1928443"},
-]
-
[[package]]
name = "mypy-extensions"
version = "1.0.0"
]
[[package]]
-name = "paginate"
-version = "0.5.6"
-description = "Divides large result sets into pages for easier browsing"
+name = "pallets-sphinx-themes"
+version = "2.1.3"
+description = "Sphinx themes for Pallets and related projects."
optional = false
-python-versions = "*"
+python-versions = ">=3.8"
files = [
- {file = "paginate-0.5.6.tar.gz", hash = "sha256:5e6007b6a9398177a7e1648d04fdd9f8c9766a1a945bceac82f1929e8c78af2d"},
+ {file = "pallets_sphinx_themes-2.1.3-py3-none-any.whl", hash = "sha256:cd452422d97159c966904f81950c9be650583a3633b85d6321e23fb31b43a1d0"},
+ {file = "pallets_sphinx_themes-2.1.3.tar.gz", hash = "sha256:853ccdc2698ab0a2532cfc23037e08ff16ef36fdbde57dda122946bba1f71c0a"},
]
+[package.dependencies]
+packaging = "*"
+sphinx = ">=3"
+
[[package]]
name = "pandas"
version = "2.2.2"
[package.extras]
windows-terminal = ["colorama (>=0.4.6)"]
-[[package]]
-name = "pymdown-extensions"
-version = "10.8.1"
-description = "Extension pack for Python Markdown."
-optional = false
-python-versions = ">=3.8"
-files = [
- {file = "pymdown_extensions-10.8.1-py3-none-any.whl", hash = "sha256:f938326115884f48c6059c67377c46cf631c733ef3629b6eed1349989d1b30cb"},
- {file = "pymdown_extensions-10.8.1.tar.gz", hash = "sha256:3ab1db5c9e21728dabf75192d71471f8e50f216627e9a1fa9535ecb0231b9940"},
-]
-
-[package.dependencies]
-markdown = ">=3.6"
-pyyaml = "*"
-
-[package.extras]
-extra = ["pygments (>=2.12)"]
-
[[package]]
name = "python-dateutil"
version = "2.9.0.post0"
{file = "PyYAML-6.0.1.tar.gz", hash = "sha256:bfdf460b1736c775f2ba9f6a92bca30bc2095067b8a9d77876d1fad6cc3b4a43"},
]
-[[package]]
-name = "pyyaml-env-tag"
-version = "0.1"
-description = "A custom YAML tag for referencing environment variables in YAML files. "
-optional = false
-python-versions = ">=3.6"
-files = [
- {file = "pyyaml_env_tag-0.1-py3-none-any.whl", hash = "sha256:af31106dec8a4d68c60207c1886031cbf839b68aa7abccdb19868200532c2069"},
- {file = "pyyaml_env_tag-0.1.tar.gz", hash = "sha256:70092675bda14fdec33b31ba77e7543de9ddc88f2e5b99160396572d11525bdb"},
-]
-
-[package.dependencies]
-pyyaml = "*"
-
[[package]]
name = "referencing"
version = "0.35.1"
attrs = ">=22.2.0"
rpds-py = ">=0.7.0"
-[[package]]
-name = "regex"
-version = "2024.5.15"
-description = "Alternative regular expression module, to replace re."
-optional = false
-python-versions = ">=3.8"
-files = [
- {file = "regex-2024.5.15-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:a81e3cfbae20378d75185171587cbf756015ccb14840702944f014e0d93ea09f"},
- {file = "regex-2024.5.15-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:7b59138b219ffa8979013be7bc85bb60c6f7b7575df3d56dc1e403a438c7a3f6"},
- {file = "regex-2024.5.15-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:a0bd000c6e266927cb7a1bc39d55be95c4b4f65c5be53e659537537e019232b1"},
- {file = "regex-2024.5.15-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5eaa7ddaf517aa095fa8da0b5015c44d03da83f5bd49c87961e3c997daed0de7"},
- {file = "regex-2024.5.15-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:ba68168daedb2c0bab7fd7e00ced5ba90aebf91024dea3c88ad5063c2a562cca"},
- {file = "regex-2024.5.15-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:6e8d717bca3a6e2064fc3a08df5cbe366369f4b052dcd21b7416e6d71620dca1"},
- {file = "regex-2024.5.15-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1337b7dbef9b2f71121cdbf1e97e40de33ff114801263b275aafd75303bd62b5"},
- {file = "regex-2024.5.15-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:f9ebd0a36102fcad2f03696e8af4ae682793a5d30b46c647eaf280d6cfb32796"},
- {file = "regex-2024.5.15-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:9efa1a32ad3a3ea112224897cdaeb6aa00381627f567179c0314f7b65d354c62"},
- {file = "regex-2024.5.15-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:1595f2d10dff3d805e054ebdc41c124753631b6a471b976963c7b28543cf13b0"},
- {file = "regex-2024.5.15-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:b802512f3e1f480f41ab5f2cfc0e2f761f08a1f41092d6718868082fc0d27143"},
- {file = "regex-2024.5.15-cp310-cp310-musllinux_1_2_ppc64le.whl", hash = "sha256:a0981022dccabca811e8171f913de05720590c915b033b7e601f35ce4ea7019f"},
- {file = "regex-2024.5.15-cp310-cp310-musllinux_1_2_s390x.whl", hash = "sha256:19068a6a79cf99a19ccefa44610491e9ca02c2be3305c7760d3831d38a467a6f"},
- {file = "regex-2024.5.15-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:1b5269484f6126eee5e687785e83c6b60aad7663dafe842b34691157e5083e53"},
- {file = "regex-2024.5.15-cp310-cp310-win32.whl", hash = "sha256:ada150c5adfa8fbcbf321c30c751dc67d2f12f15bd183ffe4ec7cde351d945b3"},
- {file = "regex-2024.5.15-cp310-cp310-win_amd64.whl", hash = "sha256:ac394ff680fc46b97487941f5e6ae49a9f30ea41c6c6804832063f14b2a5a145"},
- {file = "regex-2024.5.15-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:f5b1dff3ad008dccf18e652283f5e5339d70bf8ba7c98bf848ac33db10f7bc7a"},
- {file = "regex-2024.5.15-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:c6a2b494a76983df8e3d3feea9b9ffdd558b247e60b92f877f93a1ff43d26656"},
- {file = "regex-2024.5.15-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:a32b96f15c8ab2e7d27655969a23895eb799de3665fa94349f3b2fbfd547236f"},
- {file = "regex-2024.5.15-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:10002e86e6068d9e1c91eae8295ef690f02f913c57db120b58fdd35a6bb1af35"},
- {file = "regex-2024.5.15-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:ec54d5afa89c19c6dd8541a133be51ee1017a38b412b1321ccb8d6ddbeb4cf7d"},
- {file = "regex-2024.5.15-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:10e4ce0dca9ae7a66e6089bb29355d4432caed736acae36fef0fdd7879f0b0cb"},
- {file = "regex-2024.5.15-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3e507ff1e74373c4d3038195fdd2af30d297b4f0950eeda6f515ae3d84a1770f"},
- {file = "regex-2024.5.15-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:d1f059a4d795e646e1c37665b9d06062c62d0e8cc3c511fe01315973a6542e40"},
- {file = "regex-2024.5.15-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:0721931ad5fe0dda45d07f9820b90b2148ccdd8e45bb9e9b42a146cb4f695649"},
- {file = "regex-2024.5.15-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:833616ddc75ad595dee848ad984d067f2f31be645d603e4d158bba656bbf516c"},
- {file = "regex-2024.5.15-cp311-cp311-musllinux_1_2_ppc64le.whl", hash = "sha256:287eb7f54fc81546346207c533ad3c2c51a8d61075127d7f6d79aaf96cdee890"},
- {file = "regex-2024.5.15-cp311-cp311-musllinux_1_2_s390x.whl", hash = "sha256:19dfb1c504781a136a80ecd1fff9f16dddf5bb43cec6871778c8a907a085bb3d"},
- {file = "regex-2024.5.15-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:119af6e56dce35e8dfb5222573b50c89e5508d94d55713c75126b753f834de68"},
- {file = "regex-2024.5.15-cp311-cp311-win32.whl", hash = "sha256:1c1c174d6ec38d6c8a7504087358ce9213d4332f6293a94fbf5249992ba54efa"},
- {file = "regex-2024.5.15-cp311-cp311-win_amd64.whl", hash = "sha256:9e717956dcfd656f5055cc70996ee2cc82ac5149517fc8e1b60261b907740201"},
- {file = "regex-2024.5.15-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:632b01153e5248c134007209b5c6348a544ce96c46005d8456de1d552455b014"},
- {file = "regex-2024.5.15-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:e64198f6b856d48192bf921421fdd8ad8eb35e179086e99e99f711957ffedd6e"},
- {file = "regex-2024.5.15-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:68811ab14087b2f6e0fc0c2bae9ad689ea3584cad6917fc57be6a48bbd012c49"},
- {file = "regex-2024.5.15-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f8ec0c2fea1e886a19c3bee0cd19d862b3aa75dcdfb42ebe8ed30708df64687a"},
- {file = "regex-2024.5.15-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:d0c0c0003c10f54a591d220997dd27d953cd9ccc1a7294b40a4be5312be8797b"},
- {file = "regex-2024.5.15-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:2431b9e263af1953c55abbd3e2efca67ca80a3de8a0437cb58e2421f8184717a"},
- {file = "regex-2024.5.15-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4a605586358893b483976cffc1723fb0f83e526e8f14c6e6614e75919d9862cf"},
- {file = "regex-2024.5.15-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:391d7f7f1e409d192dba8bcd42d3e4cf9e598f3979cdaed6ab11288da88cb9f2"},
- {file = "regex-2024.5.15-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:9ff11639a8d98969c863d4617595eb5425fd12f7c5ef6621a4b74b71ed8726d5"},
- {file = "regex-2024.5.15-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:4eee78a04e6c67e8391edd4dad3279828dd66ac4b79570ec998e2155d2e59fd5"},
- {file = "regex-2024.5.15-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:8fe45aa3f4aa57faabbc9cb46a93363edd6197cbc43523daea044e9ff2fea83e"},
- {file = "regex-2024.5.15-cp312-cp312-musllinux_1_2_s390x.whl", hash = "sha256:d0a3d8d6acf0c78a1fff0e210d224b821081330b8524e3e2bc5a68ef6ab5803d"},
- {file = "regex-2024.5.15-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:c486b4106066d502495b3025a0a7251bf37ea9540433940a23419461ab9f2a80"},
- {file = "regex-2024.5.15-cp312-cp312-win32.whl", hash = "sha256:c49e15eac7c149f3670b3e27f1f28a2c1ddeccd3a2812cba953e01be2ab9b5fe"},
- {file = "regex-2024.5.15-cp312-cp312-win_amd64.whl", hash = "sha256:673b5a6da4557b975c6c90198588181029c60793835ce02f497ea817ff647cb2"},
- {file = "regex-2024.5.15-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:87e2a9c29e672fc65523fb47a90d429b70ef72b901b4e4b1bd42387caf0d6835"},
- {file = "regex-2024.5.15-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:c3bea0ba8b73b71b37ac833a7f3fd53825924165da6a924aec78c13032f20850"},
- {file = "regex-2024.5.15-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:bfc4f82cabe54f1e7f206fd3d30fda143f84a63fe7d64a81558d6e5f2e5aaba9"},
- {file = "regex-2024.5.15-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e5bb9425fe881d578aeca0b2b4b3d314ec88738706f66f219c194d67179337cb"},
- {file = "regex-2024.5.15-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:64c65783e96e563103d641760664125e91bd85d8e49566ee560ded4da0d3e704"},
- {file = "regex-2024.5.15-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:cf2430df4148b08fb4324b848672514b1385ae3807651f3567871f130a728cc3"},
- {file = "regex-2024.5.15-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5397de3219a8b08ae9540c48f602996aa6b0b65d5a61683e233af8605c42b0f2"},
- {file = "regex-2024.5.15-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:455705d34b4154a80ead722f4f185b04c4237e8e8e33f265cd0798d0e44825fa"},
- {file = "regex-2024.5.15-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:b2b6f1b3bb6f640c1a92be3bbfbcb18657b125b99ecf141fb3310b5282c7d4ed"},
- {file = "regex-2024.5.15-cp38-cp38-musllinux_1_2_aarch64.whl", hash = "sha256:3ad070b823ca5890cab606c940522d05d3d22395d432f4aaaf9d5b1653e47ced"},
- {file = "regex-2024.5.15-cp38-cp38-musllinux_1_2_i686.whl", hash = "sha256:5b5467acbfc153847d5adb21e21e29847bcb5870e65c94c9206d20eb4e99a384"},
- {file = "regex-2024.5.15-cp38-cp38-musllinux_1_2_ppc64le.whl", hash = "sha256:e6662686aeb633ad65be2a42b4cb00178b3fbf7b91878f9446075c404ada552f"},
- {file = "regex-2024.5.15-cp38-cp38-musllinux_1_2_s390x.whl", hash = "sha256:2b4c884767504c0e2401babe8b5b7aea9148680d2e157fa28f01529d1f7fcf67"},
- {file = "regex-2024.5.15-cp38-cp38-musllinux_1_2_x86_64.whl", hash = "sha256:3cd7874d57f13bf70078f1ff02b8b0aa48d5b9ed25fc48547516c6aba36f5741"},
- {file = "regex-2024.5.15-cp38-cp38-win32.whl", hash = "sha256:e4682f5ba31f475d58884045c1a97a860a007d44938c4c0895f41d64481edbc9"},
- {file = "regex-2024.5.15-cp38-cp38-win_amd64.whl", hash = "sha256:d99ceffa25ac45d150e30bd9ed14ec6039f2aad0ffa6bb87a5936f5782fc1569"},
- {file = "regex-2024.5.15-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:13cdaf31bed30a1e1c2453ef6015aa0983e1366fad2667657dbcac7b02f67133"},
- {file = "regex-2024.5.15-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:cac27dcaa821ca271855a32188aa61d12decb6fe45ffe3e722401fe61e323cd1"},
- {file = "regex-2024.5.15-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:7dbe2467273b875ea2de38ded4eba86cbcbc9a1a6d0aa11dcf7bd2e67859c435"},
- {file = "regex-2024.5.15-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:64f18a9a3513a99c4bef0e3efd4c4a5b11228b48aa80743be822b71e132ae4f5"},
- {file = "regex-2024.5.15-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:d347a741ea871c2e278fde6c48f85136c96b8659b632fb57a7d1ce1872547600"},
- {file = "regex-2024.5.15-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:1878b8301ed011704aea4c806a3cadbd76f84dece1ec09cc9e4dc934cfa5d4da"},
- {file = "regex-2024.5.15-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4babf07ad476aaf7830d77000874d7611704a7fcf68c9c2ad151f5d94ae4bfc4"},
- {file = "regex-2024.5.15-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:35cb514e137cb3488bce23352af3e12fb0dbedd1ee6e60da053c69fb1b29cc6c"},
- {file = "regex-2024.5.15-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:cdd09d47c0b2efee9378679f8510ee6955d329424c659ab3c5e3a6edea696294"},
- {file = "regex-2024.5.15-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:72d7a99cd6b8f958e85fc6ca5b37c4303294954eac1376535b03c2a43eb72629"},
- {file = "regex-2024.5.15-cp39-cp39-musllinux_1_2_i686.whl", hash = "sha256:a094801d379ab20c2135529948cb84d417a2169b9bdceda2a36f5f10977ebc16"},
- {file = "regex-2024.5.15-cp39-cp39-musllinux_1_2_ppc64le.whl", hash = "sha256:c0c18345010870e58238790a6779a1219b4d97bd2e77e1140e8ee5d14df071aa"},
- {file = "regex-2024.5.15-cp39-cp39-musllinux_1_2_s390x.whl", hash = "sha256:16093f563098448ff6b1fa68170e4acbef94e6b6a4e25e10eae8598bb1694b5d"},
- {file = "regex-2024.5.15-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:e38a7d4e8f633a33b4c7350fbd8bad3b70bf81439ac67ac38916c4a86b465456"},
- {file = "regex-2024.5.15-cp39-cp39-win32.whl", hash = "sha256:71a455a3c584a88f654b64feccc1e25876066c4f5ef26cd6dd711308aa538694"},
- {file = "regex-2024.5.15-cp39-cp39-win_amd64.whl", hash = "sha256:cab12877a9bdafde5500206d1020a584355a97884dfd388af3699e9137bf7388"},
- {file = "regex-2024.5.15.tar.gz", hash = "sha256:d3ee02d9e5f482cc8309134a91eeaacbdd2261ba111b0fef3748eeb4913e6a2c"},
-]
-
[[package]]
name = "requests"
version = "2.32.3"
{file = "sniffio-1.3.1.tar.gz", hash = "sha256:f4324edc670a0f49750a81b895f35c3adb843cca46f0530f79fc1babb23789dc"},
]
+[[package]]
+name = "snowballstemmer"
+version = "2.2.0"
+description = "This package provides 29 stemmers for 28 languages generated from Snowball algorithms."
+optional = false
+python-versions = "*"
+files = [
+ {file = "snowballstemmer-2.2.0-py2.py3-none-any.whl", hash = "sha256:c8e1716e83cc398ae16824e5572ae04e0d9fc2c6b985fb0f900f5f0c96ecba1a"},
+ {file = "snowballstemmer-2.2.0.tar.gz", hash = "sha256:09b16deb8547d3412ad7b590689584cd0fe25ec8db3be37788be3810cbf19cb1"},
+]
+
+[[package]]
+name = "sphinx"
+version = "7.3.7"
+description = "Python documentation generator"
+optional = false
+python-versions = ">=3.9"
+files = [
+ {file = "sphinx-7.3.7-py3-none-any.whl", hash = "sha256:413f75440be4cacf328f580b4274ada4565fb2187d696a84970c23f77b64d8c3"},
+ {file = "sphinx-7.3.7.tar.gz", hash = "sha256:a4a7db75ed37531c05002d56ed6948d4c42f473a36f46e1382b0bd76ca9627bc"},
+]
+
+[package.dependencies]
+alabaster = ">=0.7.14,<0.8.0"
+babel = ">=2.9"
+colorama = {version = ">=0.4.5", markers = "sys_platform == \"win32\""}
+docutils = ">=0.18.1,<0.22"
+imagesize = ">=1.3"
+importlib-metadata = {version = ">=4.8", markers = "python_version < \"3.10\""}
+Jinja2 = ">=3.0"
+packaging = ">=21.0"
+Pygments = ">=2.14"
+requests = ">=2.25.0"
+snowballstemmer = ">=2.0"
+sphinxcontrib-applehelp = "*"
+sphinxcontrib-devhelp = "*"
+sphinxcontrib-htmlhelp = ">=2.0.0"
+sphinxcontrib-jsmath = "*"
+sphinxcontrib-qthelp = "*"
+sphinxcontrib-serializinghtml = ">=1.1.9"
+tomli = {version = ">=2", markers = "python_version < \"3.11\""}
+
+[package.extras]
+docs = ["sphinxcontrib-websupport"]
+lint = ["flake8 (>=3.5.0)", "importlib_metadata", "mypy (==1.9.0)", "pytest (>=6.0)", "ruff (==0.3.7)", "sphinx-lint", "tomli", "types-docutils", "types-requests"]
+test = ["cython (>=3.0)", "defusedxml (>=0.7.1)", "pytest (>=6.0)", "setuptools (>=67.0)"]
+
+[[package]]
+name = "sphinx-click"
+version = "6.0.0"
+description = "Sphinx extension that automatically documents click applications"
+optional = false
+python-versions = ">=3.8"
+files = [
+ {file = "sphinx_click-6.0.0-py3-none-any.whl", hash = "sha256:1e0a3c83bcb7c55497751b19d07ebe56b5d7b85eb76dd399cf9061b497adc317"},
+ {file = "sphinx_click-6.0.0.tar.gz", hash = "sha256:f5d664321dc0c6622ff019f1e1c84e58ce0cecfddeb510e004cf60c2a3ab465b"},
+]
+
+[package.dependencies]
+click = ">=8.0"
+docutils = "*"
+sphinx = ">=4.0"
+
+[[package]]
+name = "sphinx-new-tab-link"
+version = "0.4.0"
+description = "Open external links in new tabs of the browser in Sphinx HTML documents"
+optional = false
+python-versions = "*"
+files = [
+ {file = "sphinx-new-tab-link-0.4.0.tar.gz", hash = "sha256:aaefd94d5aa75c60a6c1e94b80d75c4281c3b6f95669b8e606f212744818b916"},
+ {file = "sphinx_new_tab_link-0.4.0-py3-none-any.whl", hash = "sha256:2353bfd3a171fdbd9dcdf33e5f26b4447607293ff2b57e0f6a2dc18d1507598e"},
+]
+
+[package.dependencies]
+sphinxcontrib-extdevhelper-kasane = "*"
+
+[package.extras]
+dev = ["build", "twine", "wheel"]
+lint = ["black", "flake8", "isort"]
+testing = ["beautifulsoup4", "pytest"]
+typecheck = ["mypy", "types-beautifulsoup"]
+
+[[package]]
+name = "sphinxcontrib-applehelp"
+version = "1.0.8"
+description = "sphinxcontrib-applehelp is a Sphinx extension which outputs Apple help books"
+optional = false
+python-versions = ">=3.9"
+files = [
+ {file = "sphinxcontrib_applehelp-1.0.8-py3-none-any.whl", hash = "sha256:cb61eb0ec1b61f349e5cc36b2028e9e7ca765be05e49641c97241274753067b4"},
+ {file = "sphinxcontrib_applehelp-1.0.8.tar.gz", hash = "sha256:c40a4f96f3776c4393d933412053962fac2b84f4c99a7982ba42e09576a70619"},
+]
+
+[package.extras]
+lint = ["docutils-stubs", "flake8", "mypy"]
+standalone = ["Sphinx (>=5)"]
+test = ["pytest"]
+
+[[package]]
+name = "sphinxcontrib-devhelp"
+version = "1.0.6"
+description = "sphinxcontrib-devhelp is a sphinx extension which outputs Devhelp documents"
+optional = false
+python-versions = ">=3.9"
+files = [
+ {file = "sphinxcontrib_devhelp-1.0.6-py3-none-any.whl", hash = "sha256:6485d09629944511c893fa11355bda18b742b83a2b181f9a009f7e500595c90f"},
+ {file = "sphinxcontrib_devhelp-1.0.6.tar.gz", hash = "sha256:9893fd3f90506bc4b97bdb977ceb8fbd823989f4316b28c3841ec128544372d3"},
+]
+
+[package.extras]
+lint = ["docutils-stubs", "flake8", "mypy"]
+standalone = ["Sphinx (>=5)"]
+test = ["pytest"]
+
+[[package]]
+name = "sphinxcontrib-extdevhelper-kasane"
+version = "0.2.0"
+description = "襲 - Provide dynamic inheritance shortcuts to make Sphinx extension development easier"
+optional = false
+python-versions = ">=3.8"
+files = [
+ {file = "sphinxcontrib-extdevhelper-kasane-0.2.0.tar.gz", hash = "sha256:4dc7b00327f33c7b421c27122b40278eeaca43f24601b572cee5616d31b206a9"},
+ {file = "sphinxcontrib_extdevhelper_kasane-0.2.0-py3-none-any.whl", hash = "sha256:20f94e3b209cddec24596234458ea3887e7a7ad45b54a4d0a5bf169ff45a38f1"},
+]
+
+[package.dependencies]
+Sphinx = "*"
+
+[package.extras]
+dev = ["autoflake", "black", "flake8", "isort", "mypy", "pytest", "pytest-randomly", "pyupgrade", "taskipy"]
+
+[[package]]
+name = "sphinxcontrib-htmlhelp"
+version = "2.0.5"
+description = "sphinxcontrib-htmlhelp is a sphinx extension which renders HTML help files"
+optional = false
+python-versions = ">=3.9"
+files = [
+ {file = "sphinxcontrib_htmlhelp-2.0.5-py3-none-any.whl", hash = "sha256:393f04f112b4d2f53d93448d4bce35842f62b307ccdc549ec1585e950bc35e04"},
+ {file = "sphinxcontrib_htmlhelp-2.0.5.tar.gz", hash = "sha256:0dc87637d5de53dd5eec3a6a01753b1ccf99494bd756aafecd74b4fa9e729015"},
+]
+
+[package.extras]
+lint = ["docutils-stubs", "flake8", "mypy"]
+standalone = ["Sphinx (>=5)"]
+test = ["html5lib", "pytest"]
+
+[[package]]
+name = "sphinxcontrib-jsmath"
+version = "1.0.1"
+description = "A sphinx extension which renders display math in HTML via JavaScript"
+optional = false
+python-versions = ">=3.5"
+files = [
+ {file = "sphinxcontrib-jsmath-1.0.1.tar.gz", hash = "sha256:a9925e4a4587247ed2191a22df5f6970656cb8ca2bd6284309578f2153e0c4b8"},
+ {file = "sphinxcontrib_jsmath-1.0.1-py2.py3-none-any.whl", hash = "sha256:2ec2eaebfb78f3f2078e73666b1415417a116cc848b72e5172e596c871103178"},
+]
+
+[package.extras]
+test = ["flake8", "mypy", "pytest"]
+
+[[package]]
+name = "sphinxcontrib-mermaid"
+version = "0.9.2"
+description = "Mermaid diagrams in yours Sphinx powered docs"
+optional = false
+python-versions = ">=3.7"
+files = [
+ {file = "sphinxcontrib-mermaid-0.9.2.tar.gz", hash = "sha256:252ef13dd23164b28f16d8b0205cf184b9d8e2b714a302274d9f59eb708e77af"},
+ {file = "sphinxcontrib_mermaid-0.9.2-py3-none-any.whl", hash = "sha256:6795a72037ca55e65663d2a2c1a043d636dc3d30d418e56dd6087d1459d98a5d"},
+]
+
+[[package]]
+name = "sphinxcontrib-qthelp"
+version = "1.0.7"
+description = "sphinxcontrib-qthelp is a sphinx extension which outputs QtHelp documents"
+optional = false
+python-versions = ">=3.9"
+files = [
+ {file = "sphinxcontrib_qthelp-1.0.7-py3-none-any.whl", hash = "sha256:e2ae3b5c492d58fcbd73281fbd27e34b8393ec34a073c792642cd8e529288182"},
+ {file = "sphinxcontrib_qthelp-1.0.7.tar.gz", hash = "sha256:053dedc38823a80a7209a80860b16b722e9e0209e32fea98c90e4e6624588ed6"},
+]
+
+[package.extras]
+lint = ["docutils-stubs", "flake8", "mypy"]
+standalone = ["Sphinx (>=5)"]
+test = ["pytest"]
+
+[[package]]
+name = "sphinxcontrib-serializinghtml"
+version = "1.1.10"
+description = "sphinxcontrib-serializinghtml is a sphinx extension which outputs \"serialized\" HTML files (json and pickle)"
+optional = false
+python-versions = ">=3.9"
+files = [
+ {file = "sphinxcontrib_serializinghtml-1.1.10-py3-none-any.whl", hash = "sha256:326369b8df80a7d2d8d7f99aa5ac577f51ea51556ed974e7716cfd4fca3f6cb7"},
+ {file = "sphinxcontrib_serializinghtml-1.1.10.tar.gz", hash = "sha256:93f3f5dc458b91b192fe10c397e324f262cf163d79f3282c158e8436a2c4511f"},
+]
+
+[package.extras]
+lint = ["docutils-stubs", "flake8", "mypy"]
+standalone = ["Sphinx (>=5)"]
+test = ["pytest"]
+
[[package]]
name = "streamlit"
version = "1.35.0"
[metadata]
lock-version = "2.0"
python-versions = ">=3.9,<3.9.7 || >3.9.7,<4.0"
-content-hash = "a19d90802ba9ba601c8056a9920812ccfe59e49a0ae50d92cdf9e89f56c7718f"
+content-hash = "6b4f6eedd706b20782b173657a9e8936e20853014e2ea504f064765cd42be4f7"
click = "^8.1.7"
[tool.poetry.group.docs.dependencies]
-mkdocs = "^1.6.0"
-mkdocs-material = "^9.5.25"
+sphinx = "^7.3.7"
+pallets-sphinx-themes = "^2.1.3"
+sphinxcontrib-mermaid = "^0.9.2"
+sphinx-new-tab-link = "^0.4.0"
+sphinx-click = "^6.0.0"
[tool.poetry.group.dev.dependencies]
black = "^24.4.2"
extend-ignore = ["E203", "E701"]
[tool.poetry.scripts]
-wbt = 'waybacktweets.cli:cli'
+wbt = 'waybacktweets.cli.main:cli'
[build-system]
requires = ["poetry-core"]
+# flake8: noqa: F401
+
+from waybacktweets.api.export_tweets import TweetsExporter
+from waybacktweets.api.parse_tweets import JsonParser, TweetsParser, TwitterEmbed
+from waybacktweets.api.request_tweets import WaybackTweets
+from waybacktweets.api.viz_tweets import HTMLTweetsVisualizer
+
__version__ = "1.0"
--- /dev/null
+import datetime
+import os
+import re
+
+import pandas as pd
+
+from waybacktweets.api.viz_tweets import HTMLTweetsVisualizer
+
+
+class TweetsExporter:
+ """Handles the exporting of parsed archived tweets."""
+
+ def __init__(self, data, username, field_options):
+ self.data = data
+ self.username = username
+ self.field_options = field_options
+ self.formatted_datetime = self._datetime_now()
+ self.filename = f"{self.username}_tweets_{self.formatted_datetime}"
+ self.dataframe = self._create_dataframe(self)
+
+ @staticmethod
+ def _datetime_now():
+ """Formats datetime."""
+ now = datetime.datetime.now()
+ formatted_now = now.strftime("%Y%m%d%H%M%S")
+ formatted_now = re.sub(r"\W+", "", formatted_now)
+
+ return formatted_now
+
+ @staticmethod
+ def _transpose_matrix(data, fill_value=None):
+ """
+ Transposes a matrix, filling in missing values with a specified fill value
+ if needed.
+ """
+ max_length = max(len(sublist) for sublist in data.values())
+
+ filled_data = {
+ key: value + [fill_value] * (max_length - len(value))
+ for key, value in data.items()
+ }
+
+ data_transposed = [list(row) for row in zip(*filled_data.values())]
+
+ return data_transposed
+
+ def _create_dataframe(self):
+ """Creates a DataFrame from the transposed data."""
+ data_transposed = self._transpose_matrix(self.data)
+
+ df = pd.DataFrame(data_transposed, columns=self.field_options)
+
+ return df
+
+ def save_to_csv(self):
+ """Saves the DataFrame to a CSV file."""
+ csv_file_path = f"{self.filename}.csv"
+ self.dataframe.to_csv(csv_file_path, index=False)
+
+ print(f"Saved to {csv_file_path}")
+
+ def save_to_json(self):
+ """Saves the DataFrame to a JSON file."""
+ json_file_path = f"{self.filename}.json"
+ self.dataframe.to_json(json_file_path, orient="records", lines=False)
+
+ print(f"Saved to {json_file_path}")
+
+ def save_to_html(self):
+ """Saves the DataFrame to an HTML file."""
+ json_file_path = f"{self.filename}.json"
+
+ if not os.path.exists(json_file_path):
+ self.save_to_json()
+
+ html_file_path = f"{self.filename}.html"
+
+ html = HTMLTweetsVisualizer(json_file_path, html_file_path, self.username)
+
+ html_content = html.generate()
+ html.save(html_content)
+
+ print(f"Saved to {html_file_path}")
--- /dev/null
+import re
+from concurrent.futures import ThreadPoolExecutor, as_completed
+from urllib.parse import unquote
+
+from requests import exceptions
+from rich import print as rprint
+from rich.progress import Progress
+
+from waybacktweets.utils.utils import (
+ check_double_status,
+ check_pattern_tweet,
+ clean_tweet_url,
+ delete_tweet_pathnames,
+ get_response,
+ semicolon_parser,
+)
+
+
+class TwitterEmbed:
+ """Handles parsing of tweets using the Twitter Publish service."""
+
+ def __init__(self, tweet_url):
+ self.tweet_url = tweet_url
+
+ def embed(self):
+ """Parses the archived tweets when they are still available."""
+ try:
+ url = f"https://publish.twitter.com/oembed?url={self.tweet_url}"
+ response = get_response(url=url)
+
+ if response:
+ json_response = response.json()
+ html = json_response["html"]
+ author_name = json_response["author_name"]
+
+ regex = re.compile(
+ r'<blockquote class="twitter-tweet"(?: [^>]+)?><p[^>]*>(.*?)<\/p>.*?— (.*?)<\/a>', # noqa
+ re.DOTALL,
+ )
+ regex_author = re.compile(r"^(.*?)\s*\(")
+
+ matches_html = regex.findall(html)
+
+ tweet_content = []
+ user_info = []
+ is_RT = []
+
+ for match in matches_html:
+ tweet_content_match = re.sub(
+ r"<a[^>]*>|<\/a>", "", match[0].strip()
+ ).replace("<br>", "\n")
+ user_info_match = re.sub(
+ r"<a[^>]*>|<\/a>", "", match[1].strip()
+ ).replace(")", "), ")
+ match_author = regex_author.search(user_info_match)
+ author_tweet = match_author.group(1) if match_author else ""
+
+ if tweet_content_match:
+ tweet_content.append(tweet_content_match)
+ if user_info_match:
+ user_info.append(user_info_match)
+ is_RT.append(author_name != author_tweet)
+
+ return tweet_content, is_RT, user_info
+ except exceptions:
+ rprint("[yellow]Error parsing the tweet, but the CDX data was saved.")
+ return None
+
+
+class JsonParser:
+ """Handles parsing of tweets when the mimetype is application/json."""
+
+ def __init__(self, archived_tweet_url):
+ self.archived_tweet_url = archived_tweet_url
+
+ def parse(self):
+ """Parses the archived tweets in JSON format."""
+ try:
+ response = get_response(url=self.archived_tweet_url)
+
+ if response:
+ json_data = response.json()
+
+ if "data" in json_data:
+ return json_data["data"].get("text", json_data["data"])
+
+ if "retweeted_status" in json_data:
+ return json_data["retweeted_status"].get(
+ "text", json_data["retweeted_status"]
+ )
+
+ return json_data.get("text", json_data)
+ except exceptions.ConnectionError:
+ rprint(
+ f"[yellow]Connection error with {self.archived_tweet_url}. Max retries exceeded. Error parsing the JSON, but the CDX data was saved." # noqa: E501
+ )
+ return ""
+ except exceptions:
+ rprint("[yellow]Error parsing the JSON, but the CDX data was saved.")
+
+ return ""
+
+
+class TweetsParser:
+ """Handles the overall parsing of archived tweets."""
+
+ def __init__(self, archived_tweets_response, username, field_options):
+ self.archived_tweets_response = archived_tweets_response
+ self.username = username
+ self.field_options = field_options
+ self.parsed_tweets = {option: [] for option in self.field_options}
+
+ def _add_field(self, key, value):
+ """
+ Appends a value to a list in the parsed data structure.
+ Defines which data will be structured and saved.
+ """
+ if key in self.parsed_tweets:
+ self.parsed_tweets[key].append(value)
+
+ def _process_response(self, response):
+ """Process the archived tweet's response and add the relevant CDX data."""
+ tweet_remove_char = unquote(response[2]).replace("’", "")
+ cleaned_tweet = check_pattern_tweet(tweet_remove_char).strip('"')
+
+ wayback_machine_url = (
+ f"https://web.archive.org/web/{response[1]}/{tweet_remove_char}"
+ )
+ original_tweet = delete_tweet_pathnames(
+ clean_tweet_url(cleaned_tweet, self.username)
+ )
+ parsed_wayback_machine_url = (
+ f"https://web.archive.org/web/{response[1]}/{original_tweet}"
+ )
+
+ double_status = check_double_status(wayback_machine_url, original_tweet)
+
+ if double_status:
+ original_tweet = delete_tweet_pathnames(
+ f"https://twitter.com/{original_tweet}"
+ )
+ elif "://" not in original_tweet:
+ original_tweet = delete_tweet_pathnames(f"https://{original_tweet}")
+
+ encoded_tweet = semicolon_parser(response[2])
+ encoded_archived_tweet = semicolon_parser(wayback_machine_url)
+ encoded_parsed_tweet = semicolon_parser(original_tweet)
+ encoded_parsed_archived_tweet = semicolon_parser(parsed_wayback_machine_url)
+
+ embed_parser = TwitterEmbed(encoded_tweet)
+ content = embed_parser.embed()
+
+ if content:
+ self._add_field("available_tweet_text", semicolon_parser(content[0][0]))
+ self._add_field("available_tweet_is_RT", content[1][0])
+ self._add_field("available_tweet_info", semicolon_parser(content[2][0]))
+
+ parsed_text_json = ""
+
+ if response[3] == "application/json":
+ json_parser = JsonParser(encoded_parsed_archived_tweet)
+ if json_parser:
+ text_json = json_parser.parse()
+ parsed_text_json = semicolon_parser(text_json)
+
+ self._add_field("parsed_tweet_text_mimetype_json", parsed_text_json)
+ self._add_field("archived_urlkey", response[0])
+ self._add_field("archived_timestamp", response[1])
+ self._add_field("original_tweet_url", encoded_tweet)
+ self._add_field("archived_tweet_url", encoded_archived_tweet)
+ self._add_field("parsed_tweet_url", encoded_parsed_tweet)
+ self._add_field("parsed_archived_tweet_url", encoded_parsed_archived_tweet)
+ self._add_field("archived_mimetype", response[3])
+ self._add_field("archived_statuscode", response[4])
+ self._add_field("archived_digest", response[5])
+ self._add_field("archived_length", response[6])
+
+ def parse(self):
+ """Parses the archived tweets CDX data and structures it."""
+ with ThreadPoolExecutor(max_workers=10) as executor:
+
+ futures = {
+ executor.submit(self._process_response, response): response
+ for response in self.archived_tweets_response[1:]
+ }
+ with Progress() as progress:
+ task = progress.add_task(
+ f"Waybacking @{self.username} tweets\n", total=len(futures)
+ )
+
+ for future in as_completed(futures):
+ try:
+ future.result()
+ except Exception as e:
+ rprint(f"[red]{e}...")
+
+ progress.update(task, advance=1)
+
+ return self.parsed_tweets
--- /dev/null
+from requests import exceptions
+from rich import print as rprint
+
+from waybacktweets.utils.utils import get_response
+
+
+class WaybackTweets:
+ """Requests data from the Wayback CDX Server API and returns it in JSON format."""
+
+ def __init__(self, username, unique, timestamp_from, timestamp_to, limit, offset):
+ self.username = username
+ self.unique = unique
+ self.timestamp_from = timestamp_from
+ self.timestamp_to = timestamp_to
+ self.limit = limit
+ self.offset = offset
+
+ def get(self):
+ """GET request to the Internet Archive's CDX API to retrieve archived tweets."""
+ url = "https://web.archive.org/cdx/search/cdx"
+ params = {
+ "url": f"https://twitter.com/{self.username}/status/*",
+ "output": "json",
+ }
+
+ if self.unique:
+ params["collapse"] = "urlkey"
+
+ if self.timestamp_from:
+ params["from"] = self.timestamp_from
+
+ if self.timestamp_to:
+ params["to"] = self.timestamp_to
+
+ if self.limit:
+ params["limit"] = self.limit
+
+ if self.offset:
+ params["offset"] = self.offset
+
+ print("Making a request to the Internet Archive...")
+
+ try:
+ response = get_response(url=url, params=params)
+
+ if response:
+ return response.json()
+ except exceptions.ReadTimeout:
+ rprint("[red]Connection to web.archive.org timed out.")
+ except exceptions.ConnectionError:
+ rprint(
+ "[red]Failed to establish a new connection with web.archive.org. Max retries exceeded." # noqa: E501
+ )
+ except exceptions.HTTPError:
+ rprint(
+ "[red]Temporarily Offline: Internet Archive services are temporarily offline. Please check Internet Archive Twitter feed (https://twitter.com/internetarchive) for the latest information." # noqa: E501
+ )
--- /dev/null
+# flake8: noqa: E501
+import json
+
+
+class HTMLTweetsVisualizer:
+ """Generates an HTML file to visualize the parsed data."""
+
+ def __init__(self, json_file_path, html_file_path, username):
+ self.json_content = self._json_loader(json_file_path)
+ self.html_file_path = html_file_path
+ self.username = username
+
+ @staticmethod
+ def _json_loader(json_file_path):
+ """Reads and loads JSON data from a specified file path."""
+ with open(json_file_path, "r", encoding="utf-8") as f:
+ return json.load(f)
+
+ def generate(self):
+ """Generates an HTML file."""
+
+ html = f"<html>\n<head>\n<title>@{self.username} archived tweets</title>\n"
+ html += "<style>\n"
+ html += "body { font-family: monospace; background-color: #f5f8fa; color: #1c1e21; margin: 0; padding: 20px; }\n"
+ html += ".container { display: flex; flex-wrap: wrap; gap: 20px; }\n"
+ html += ".tweet { flex: 0 1 calc(33.33% - 20px); background-color: #fff; border: 1px solid #e1e8ed; border-radius: 10px; padding: 15px; overflow-wrap: break-word; margin: auto; }\n"
+ html += ".tweet strong { font-weight: bold; }\n"
+ html += ".tweet a { color: #ef5552; text-decoration: none; }\n"
+ html += ".content { color: #ef5552; }\n"
+ html += ".tweet a:hover { text-decoration: underline; }\n"
+ html += "h1, h3 { text-align: center; }\n"
+ html += "iframe { width: 600px; height: 600px; }\n"
+ html += "</style>\n"
+ html += "</head>\n<body>\n"
+ html += f"<h1>@{self.username} archived tweets</h1>\n"
+ html += '<div class="container">\n'
+
+ for tweet in self.json_content:
+ html += '<div class="tweet">\n'
+
+ if (
+ (
+ tweet["archived_mimetype"] != "application/json"
+ and not tweet["parsed_tweet_text_mimetype_json"]
+ )
+ and not tweet["available_tweet_text"]
+ ) or (
+ (
+ tweet["archived_mimetype"] == "application/json"
+ and not tweet["parsed_tweet_text_mimetype_json"]
+ )
+ and not tweet["available_tweet_text"]
+ ):
+ html += f'<iframe src="{tweet["parsed_archived_tweet_url"]}" frameborder="0" scrolling="auto"></iframe>\n'
+
+ html += f'<p><a href="{tweet["original_tweet_url"]}" target="_blank"><strong>Original Tweet↗</strong></a> · \n'
+ html += f'<a href="{tweet["parsed_tweet_url"]}" target="_blank"><strong>Parsed Tweet↗</strong></a> · \n'
+ html += f'<a href="{tweet["archived_tweet_url"]}" target="_blank"><strong>Archived Tweet↗</strong></a> · \n'
+ html += f'<a href="{tweet["parsed_archived_tweet_url"]}" target="_blank"><strong>Parsed Archived Tweet↗</strong></a></p>\n'
+
+ if tweet["available_tweet_text"]:
+ html += "<br>\n"
+ html += f'<p><strong class="content">Available Tweet Content:</strong> {tweet["available_tweet_text"]}</p>\n'
+ html += f'<p><strong class="content">Available Tweet Is Retweet:</strong> {tweet["available_tweet_is_RT"]}</p>\n'
+ html += f'<p><strong class="content">Available Tweet Username:</strong> {tweet["available_tweet_info"]}</p>\n'
+
+ if (
+ tweet["archived_mimetype"] == "application/json"
+ and tweet["parsed_tweet_text_mimetype_json"]
+ ) and not tweet["available_tweet_text"]:
+ html += f'<p><strong class="content">Parsed Tweet Text (application/json):</strong> {tweet["parsed_tweet_text_mimetype_json"]}</p>\n'
+
+ html += "<br>\n"
+ html += f'<p><strong>Archived URL Key:</strong> {tweet["archived_urlkey"]}</p>\n'
+ html += f'<p><strong>Archived Timestamp:</strong> {tweet["archived_timestamp"]}</p>\n'
+ html += f'<p><strong>Archived mimetype:</strong> {tweet["archived_mimetype"]}</p>\n'
+ html += f'<p><strong>Archived Statuscode:</strong> {tweet["archived_statuscode"]}</p>\n'
+ html += (
+ f'<p><strong>Archived Digest:</strong> {tweet["archived_digest"]}</p>\n'
+ )
+ html += (
+ f'<p><strong>Archived Length:</strong> {tweet["archived_length"]}</p>\n'
+ )
+ html += "</div>\n"
+
+ html += "</div>\n"
+ html += '<h3>generated by <a href="https://github.com/claromes/waybacktweets" target="_blank">Wayback Tweets↗</a></h3>\n'
+ html += "</body>\n</html>"
+
+ return html
+
+ def save(self, html_content):
+ """Saves the generated HTML."""
+ with open(self.html_file_path, "w", encoding="utf-8") as f:
+ f.write(html_content)
+++ /dev/null
-"""
-CLI functions for retrieving archived tweets.
-"""
-
-from datetime import datetime
-
-import click
-from requests import exceptions
-from rich import print as rprint
-
-from waybacktweets.export_tweets import TweetsExporter
-from waybacktweets.parse_tweets import TweetsParser
-from waybacktweets.request_tweets import WaybackTweets
-
-
-def parse_date(ctx, param, value):
- if value is None:
- return None
-
- date = datetime.strptime(value, "%Y%m%d")
- return date.strftime("%Y%m%d")
-
-
-@click.command()
-@click.argument("username", type=str)
-@click.option(
- "--unique",
- type=bool,
- default=False,
- help="Only show unique URLs. Filtering by the collapse option using the urlkey field.", # noqa: E501
-)
-@click.option(
- "--from",
- "timestamp_from",
- type=click.UNPROCESSED,
- callback=parse_date,
- default=None,
- help="Filtering by date range from this date.",
-)
-@click.option(
- "--to",
- "timestamp_to",
- type=click.UNPROCESSED,
- callback=parse_date,
- default=None,
- help="Filtering by date range up to this date.",
-)
-@click.option("--limit", type=int, default=None, help="Query result limits.")
-@click.option(
- "--offset",
- type=int,
- default=None,
- help="Allows for a simple way to scroll through the results.",
-)
-def cli(username, unique, timestamp_from, timestamp_to, limit, offset):
- """
- Retrieves archived tweets' CDX data from the Wayback Machine,
- performs necessary parsing, and saves the data.
-
- USERNAME: The Twitter username without @.
- """
- try:
- api = WaybackTweets(
- username, unique, timestamp_from, timestamp_to, limit, offset
- )
- archived_tweets = api.get()
-
- if archived_tweets:
- field_options = [
- "archived_urlkey",
- "archived_timestamp",
- "original_tweet_url",
- "archived_tweet_url",
- "parsed_tweet_url",
- "parsed_archived_tweet_url",
- "parsed_tweet_text_mimetype_json",
- "available_tweet_text",
- "available_tweet_is_RT",
- "available_tweet_info",
- "archived_mimetype",
- "archived_statuscode",
- "archived_digest",
- "archived_length",
- ]
-
- parser = TweetsParser(archived_tweets, username, field_options)
- parsed_tweets = parser.parse()
-
- exporter = TweetsExporter(parsed_tweets, username, field_options)
-
- exporter.save_to_csv()
- exporter.save_to_json()
- exporter.save_to_html()
-
- except exceptions as e:
- rprint(f"[red]{e}")
- finally:
- rprint(
- "[yellow]\nNeed help? Open an issue: https://github.com/claromes/waybacktweets/issues" # noqa: E501
- )
--- /dev/null
+# flake8: noqa: F401
+
+from waybacktweets.cli.main import cli
--- /dev/null
+"""
+CLI function for retrieving archived tweets.
+"""
+
+from typing import Optional
+
+import click
+from requests import exceptions
+from rich import print as rprint
+
+from waybacktweets.api.export_tweets import TweetsExporter
+from waybacktweets.api.parse_tweets import TweetsParser
+from waybacktweets.api.request_tweets import WaybackTweets
+from waybacktweets.utils.utils import parse_date
+
+
+@click.command()
+@click.argument("username", type=str)
+@click.option(
+ "--unique",
+ type=bool,
+ default=False,
+ help="Only show unique URLs. Filtering by the collapse option using the urlkey field.", # noqa: E501
+)
+@click.option(
+ "--from",
+ "timestamp_from",
+ type=click.UNPROCESSED,
+ callback=parse_date,
+ default=None,
+ help="Filtering by date range from this date.",
+)
+@click.option(
+ "--to",
+ "timestamp_to",
+ type=click.UNPROCESSED,
+ callback=parse_date,
+ default=None,
+ help="Filtering by date range up to this date.",
+)
+@click.option("--limit", type=int, default=None, help="Query result limits.")
+@click.option(
+ "--offset",
+ type=int,
+ default=None,
+ help="Allows for a simple way to scroll through the results.",
+)
+def cli(
+ username: str,
+ unique: bool,
+ timestamp_from: Optional[str],
+ timestamp_to: Optional[str],
+ limit: Optional[int],
+ offset: Optional[int],
+) -> None:
+ """
+ Retrieves archived tweets' CDX data from the Wayback Machine,
+ performs necessary parsing, and saves the data.
+
+ USERNAME: The Twitter username without @.
+ """
+ try:
+ api = WaybackTweets(
+ username, unique, timestamp_from, timestamp_to, limit, offset
+ )
+ archived_tweets = api.get()
+
+ if archived_tweets:
+ field_options = [
+ "archived_urlkey",
+ "archived_timestamp",
+ "original_tweet_url",
+ "archived_tweet_url",
+ "parsed_tweet_url",
+ "parsed_archived_tweet_url",
+ "parsed_tweet_text_mimetype_json",
+ "available_tweet_text",
+ "available_tweet_is_RT",
+ "available_tweet_info",
+ "archived_mimetype",
+ "archived_statuscode",
+ "archived_digest",
+ "archived_length",
+ ]
+
+ parser = TweetsParser(archived_tweets, username, field_options)
+ parsed_tweets = parser.parse()
+
+ exporter = TweetsExporter(parsed_tweets, username, field_options)
+
+ exporter.save_to_csv()
+ exporter.save_to_json()
+ exporter.save_to_html()
+
+ except exceptions as e:
+ rprint(f"[red]{e}")
+ finally:
+ rprint(
+ "[yellow]\nNeed help? Open an issue: https://github.com/claromes/waybacktweets/issues" # noqa: E501
+ )
+++ /dev/null
-import datetime
-import os
-import re
-
-import pandas as pd
-
-from waybacktweets.viz_tweets import HTMLTweetsVisualizer
-
-
-class TweetsExporter:
- """Handles the exporting of parsed archived tweets."""
-
- def __init__(self, data, username, field_options):
- self.data = data
- self.username = username
- self.field_options = field_options
- self.formatted_datetime = self.datetime_now()
- self.filename = f"{self.username}_tweets_{self.formatted_datetime}"
- self.dataframe = self.create_dataframe(self)
-
- @staticmethod
- def datetime_now():
- """Formats datetime."""
- now = datetime.datetime.now()
- formatted_now = now.strftime("%Y%m%d%H%M%S")
- formatted_now = re.sub(r"\W+", "", formatted_now)
-
- return formatted_now
-
- @staticmethod
- def transpose_matrix(data, fill_value=None):
- """
- Transposes a matrix, filling in missing values with a specified fill value
- if needed.
- """
- max_length = max(len(sublist) for sublist in data.values())
-
- filled_data = {
- key: value + [fill_value] * (max_length - len(value))
- for key, value in data.items()
- }
-
- data_transposed = [list(row) for row in zip(*filled_data.values())]
-
- return data_transposed
-
- @staticmethod
- def create_dataframe(self):
- """Creates a DataFrame from the transposed data."""
- data_transposed = self.transpose_matrix(self.data)
-
- df = pd.DataFrame(data_transposed, columns=self.field_options)
-
- return df
-
- def save_to_csv(self):
- """Saves the DataFrame to a CSV file."""
- csv_file_path = f"{self.filename}.csv"
- self.dataframe.to_csv(csv_file_path, index=False)
-
- print(f"Saved to {csv_file_path}")
-
- def save_to_json(self):
- """Saves the DataFrame to a JSON file."""
- json_file_path = f"{self.filename}.json"
- self.dataframe.to_json(json_file_path, orient="records", lines=False)
-
- print(f"Saved to {json_file_path}")
-
- def save_to_html(self):
- """Saves the DataFrame to an HTML file."""
- json_file_path = f"{self.filename}.json"
-
- if not os.path.exists(json_file_path):
- self.save_to_json()
-
- html_file_path = f"{self.filename}.html"
-
- html = HTMLTweetsVisualizer(json_file_path, html_file_path, self.username)
-
- html_content = html.generate()
- html.save(html_content)
-
- print(f"Saved to {html_file_path}")
+++ /dev/null
-import re
-from concurrent.futures import ThreadPoolExecutor, as_completed
-from urllib.parse import unquote
-
-from requests import exceptions
-from rich import print as rprint
-from rich.progress import Progress
-
-from waybacktweets.utils import (
- check_double_status,
- check_pattern_tweet,
- clean_tweet_url,
- delete_tweet_pathnames,
- get_response,
- semicolon_parser,
-)
-
-
-class TwitterEmbed:
- """Handles parsing of tweets using the Twitter Publish service."""
-
- def __init__(self, tweet_url):
- self.tweet_url = tweet_url
-
- def embed(self):
- """Parses the archived tweets when they are still available."""
- try:
- url = f"https://publish.twitter.com/oembed?url={self.tweet_url}"
- response = get_response(url=url)
-
- if response:
- json_response = response.json()
- html = json_response["html"]
- author_name = json_response["author_name"]
-
- regex = re.compile(
- r'<blockquote class="twitter-tweet"(?: [^>]+)?><p[^>]*>(.*?)<\/p>.*?— (.*?)<\/a>', # noqa
- re.DOTALL,
- )
- regex_author = re.compile(r"^(.*?)\s*\(")
-
- matches_html = regex.findall(html)
-
- tweet_content = []
- user_info = []
- is_RT = []
-
- for match in matches_html:
- tweet_content_match = re.sub(
- r"<a[^>]*>|<\/a>", "", match[0].strip()
- ).replace("<br>", "\n")
- user_info_match = re.sub(
- r"<a[^>]*>|<\/a>", "", match[1].strip()
- ).replace(")", "), ")
- match_author = regex_author.search(user_info_match)
- author_tweet = match_author.group(1) if match_author else ""
-
- if tweet_content_match:
- tweet_content.append(tweet_content_match)
- if user_info_match:
- user_info.append(user_info_match)
- is_RT.append(author_name != author_tweet)
-
- return tweet_content, is_RT, user_info
- except exceptions:
- rprint("[yellow]Error parsing the tweet, but the CDX data was saved.")
- return None
-
-
-class JsonParser:
- """Handles parsing of tweets when the mimetype is application/json."""
-
- def __init__(self, archived_tweet_url):
- self.archived_tweet_url = archived_tweet_url
-
- def parse(self):
- """Parses the archived tweets in JSON format."""
- try:
- response = get_response(url=self.archived_tweet_url)
-
- if response:
- json_data = response.json()
-
- if "data" in json_data:
- return json_data["data"].get("text", json_data["data"])
-
- if "retweeted_status" in json_data:
- return json_data["retweeted_status"].get(
- "text", json_data["retweeted_status"]
- )
-
- return json_data.get("text", json_data)
- except exceptions.ConnectionError:
- rprint(
- f"[yellow]Connection error with {self.archived_tweet_url}. Max retries exceeded. Error parsing the JSON, but the CDX data was saved." # noqa: E501
- )
- return ""
- except exceptions:
- rprint("[yellow]Error parsing the JSON, but the CDX data was saved.")
-
- return ""
-
-
-class TweetsParser:
- """Handles the overall parsing of archived tweets."""
-
- def __init__(self, archived_tweets_response, username, field_options):
- self.archived_tweets_response = archived_tweets_response
- self.username = username
- self.field_options = field_options
- self.parsed_tweets = {option: [] for option in self.field_options}
-
- def add_field(self, key, value):
- """
- Appends a value to a list in the parsed data structure.
- Defines which data will be structured and saved.
- """
- if key in self.parsed_tweets:
- self.parsed_tweets[key].append(value)
-
- def process_response(self, response):
- """Process the archived tweet's response and add the relevant CDX data."""
- tweet_remove_char = unquote(response[2]).replace("’", "")
- cleaned_tweet = check_pattern_tweet(tweet_remove_char).strip('"')
-
- wayback_machine_url = (
- f"https://web.archive.org/web/{response[1]}/{tweet_remove_char}"
- )
- original_tweet = delete_tweet_pathnames(
- clean_tweet_url(cleaned_tweet, self.username)
- )
- parsed_wayback_machine_url = (
- f"https://web.archive.org/web/{response[1]}/{original_tweet}"
- )
-
- double_status = check_double_status(wayback_machine_url, original_tweet)
-
- if double_status:
- original_tweet = delete_tweet_pathnames(
- f"https://twitter.com/{original_tweet}"
- )
- elif "://" not in original_tweet:
- original_tweet = delete_tweet_pathnames(f"https://{original_tweet}")
-
- encoded_tweet = semicolon_parser(response[2])
- encoded_archived_tweet = semicolon_parser(wayback_machine_url)
- encoded_parsed_tweet = semicolon_parser(original_tweet)
- encoded_parsed_archived_tweet = semicolon_parser(parsed_wayback_machine_url)
-
- embed_parser = TwitterEmbed(encoded_tweet)
- content = embed_parser.embed()
-
- if content:
- self.add_field("available_tweet_text", semicolon_parser(content[0][0]))
- self.add_field("available_tweet_is_RT", content[1][0])
- self.add_field("available_tweet_info", semicolon_parser(content[2][0]))
-
- parsed_text_json = ""
-
- if response[3] == "application/json":
- json_parser = JsonParser(encoded_parsed_archived_tweet)
- if json_parser:
- text_json = json_parser.parse()
- parsed_text_json = semicolon_parser(text_json)
-
- self.add_field("parsed_tweet_text_mimetype_json", parsed_text_json)
- self.add_field("archived_urlkey", response[0])
- self.add_field("archived_timestamp", response[1])
- self.add_field("original_tweet_url", encoded_tweet)
- self.add_field("archived_tweet_url", encoded_archived_tweet)
- self.add_field("parsed_tweet_url", encoded_parsed_tweet)
- self.add_field("parsed_archived_tweet_url", encoded_parsed_archived_tweet)
- self.add_field("archived_mimetype", response[3])
- self.add_field("archived_statuscode", response[4])
- self.add_field("archived_digest", response[5])
- self.add_field("archived_length", response[6])
-
- def parse(self):
- """Parses the archived tweets CDX data and structures it."""
- with ThreadPoolExecutor(max_workers=10) as executor:
-
- futures = {
- executor.submit(self.process_response, response): response
- for response in self.archived_tweets_response[1:]
- }
- with Progress() as progress:
- task = progress.add_task(
- f"Waybacking @{self.username} tweets\n", total=len(futures)
- )
-
- for future in as_completed(futures):
- try:
- future.result()
- except Exception as e:
- rprint(f"[red]{e}...")
-
- progress.update(task, advance=1)
-
- return self.parsed_tweets
+++ /dev/null
-from requests import exceptions
-from rich import print as rprint
-
-from waybacktweets.utils import get_response
-
-
-class WaybackTweets:
- """Requests data from the Wayback CDX Server API and returns it in JSON format."""
-
- def __init__(self, username, unique, timestamp_from, timestamp_to, limit, offset):
- self.username = username
- self.unique = unique
- self.timestamp_from = timestamp_from
- self.timestamp_to = timestamp_to
- self.limit = limit
- self.offset = offset
-
- def get(self):
- """GET request to the Internet Archive's CDX API to retrieve archived tweets."""
- url = "https://web.archive.org/cdx/search/cdx"
- params = {
- "url": f"https://twitter.com/{self.username}/status/*",
- "output": "json",
- }
-
- if self.unique:
- params["collapse"] = "urlkey"
-
- if self.timestamp_from:
- params["from"] = self.timestamp_from
-
- if self.timestamp_to:
- params["to"] = self.timestamp_to
-
- if self.limit:
- params["limit"] = self.limit
-
- if self.offset:
- params["offset"] = self.offset
-
- print("Making a request to the Internet Archive...")
-
- try:
- response = get_response(url=url, params=params)
-
- if response:
- return response.json()
- except exceptions.ReadTimeout:
- rprint("[red]Connection to web.archive.org timed out.")
- except exceptions.ConnectionError:
- rprint(
- "[red]Failed to establish a new connection with web.archive.org. Max retries exceeded." # noqa: E501
- )
- except exceptions.HTTPError:
- rprint(
- "[red]Temporarily Offline: Internet Archive services are temporarily offline. Please check Internet Archive Twitter feed (https://twitter.com/internetarchive) for the latest information." # noqa: E501
- )
- except UnboundLocalError as e:
- rprint(f"[red]{e}")
+++ /dev/null
-"""
-Helper functions.
-"""
-
-import re
-
-import requests
-from requests.adapters import HTTPAdapter
-from urllib3.util.retry import Retry
-
-
-def get_response(url, params=None):
- """Sends a GET request to the specified URL and returns the response."""
- session = requests.Session()
- retry = Retry(connect=3, backoff_factor=0.3)
- adapter = HTTPAdapter(max_retries=retry)
- headers = {
- "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36" # noqa: E501
- }
-
- session.mount("http://", adapter)
- session.mount("https://", adapter)
-
- response = session.get(url, params=params, headers=headers)
-
- if not 400 <= response.status_code <= 511:
- return response
-
-
-def clean_tweet_url(tweet_url, username):
- """
- Converts the tweet to lowercase,
- checks if it contains a tweet URL associated with the username.
- Returns the original tweet URL with correct casing;
- or returns the original tweet.
- """
- tweet_lower = tweet_url.lower()
-
- pattern = re.compile(r"/status/(\d+)")
- match_lower_case = pattern.search(tweet_lower)
- match_original_case = pattern.search(tweet_url)
-
- if match_lower_case and username in tweet_lower:
- return f"https://twitter.com/{username}/status/{match_original_case.group(1)}"
- else:
- return tweet_url
-
-
-def clean_wayback_machine_url(wayback_machine_url, archived_timestamp, username):
- """
- Converts the Wayback Machine URL to lowercase,
- checks if it contains a tweet URL associated with the username.
- Returns the original tweet URL with correct casing and archived timestamp;
- otherwise, it returns the original Wayback Machine URL.
- """
- wayback_machine_url = wayback_machine_url.lower()
-
- pattern = re.compile(r"/status/(\d+)")
- match = pattern.search(wayback_machine_url)
-
- if match and username in wayback_machine_url:
- return f"https://web.archive.org/web/{archived_timestamp}/https://twitter.com/{username}/status/{match.group(1)}" # noqa: E501
- else:
- return wayback_machine_url
-
-
-def check_pattern_tweet(tweet_url):
- """
- Extracts tweet IDs from various types of tweet URLs or tweet-related patterns.
-
- Reply pattern: /status//
- Link pattern: /status///
- Twimg pattern: /status/https://pbs
- """
- pattern = re.compile(r'/status/"([^"]+)"')
-
- match = pattern.search(tweet_url)
- if match:
- return match.group(1).lstrip("/")
- else:
- return tweet_url
-
-
-def delete_tweet_pathnames(tweet_url):
- """Removes any pathnames (/photos, /likes, /retweet...) from the tweet URL."""
- pattern_username = re.compile(r"https://twitter\.com/([^/]+)/status/\d+")
- match_username = pattern_username.match(tweet_url)
-
- pattern_id = r"https://twitter.com/\w+/status/(\d+)"
- match_id = re.search(pattern_id, tweet_url)
-
- if match_id and match_username:
- tweet_id = match_id.group(1)
- username = match_username.group(1)
- return f"https://twitter.com/{username}/status/{tweet_id}"
- else:
- return tweet_url
-
-
-def check_double_status(wayback_machine_url, original_tweet_url):
- """
- Checks if a Wayback Machine URL contains two occurrences of "/status/"
- and if the original tweet does not contain "twitter.com".
- Returns a boolean.
- """
- if (
- wayback_machine_url.count("/status/") == 2
- and "twitter.com" not in original_tweet_url
- ):
- return True
-
- return False
-
-
-def semicolon_parser(string):
- """Replaces semicolons in a string with %3B."""
- return "".join("%3B" if c == ";" else c for c in string)
--- /dev/null
+# flake8: noqa: F401
+
+from waybacktweets.utils.utils import *
--- /dev/null
+"""
+Helper functions.
+"""
+
+import re
+from datetime import datetime
+
+import requests
+from requests.adapters import HTTPAdapter
+from urllib3.util.retry import Retry
+
+
+def get_response(url, params=None):
+ """Sends a GET request to the specified URL and returns the response."""
+ session = requests.Session()
+ retry = Retry(connect=3, backoff_factor=0.3)
+ adapter = HTTPAdapter(max_retries=retry)
+ headers = {
+ "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36" # noqa: E501
+ }
+
+ session.mount("http://", adapter)
+ session.mount("https://", adapter)
+
+ response = session.get(url, params=params, headers=headers)
+
+ if not 400 <= response.status_code <= 511:
+ return response
+
+
+def clean_tweet_url(tweet_url, username):
+ """
+ Converts the tweet to lowercase,
+ checks if it contains a tweet URL associated with the username.
+ Returns the original tweet URL with correct casing;
+ or returns the original tweet.
+ """
+ tweet_lower = tweet_url.lower()
+
+ pattern = re.compile(r"/status/(\d+)")
+ match_lower_case = pattern.search(tweet_lower)
+ match_original_case = pattern.search(tweet_url)
+
+ if match_lower_case and username in tweet_lower:
+ return f"https://twitter.com/{username}/status/{match_original_case.group(1)}"
+ else:
+ return tweet_url
+
+
+def clean_wayback_machine_url(wayback_machine_url, archived_timestamp, username):
+ """
+ Converts the Wayback Machine URL to lowercase,
+ checks if it contains a tweet URL associated with the username.
+ Returns the original tweet URL with correct casing and archived timestamp;
+ otherwise, it returns the original Wayback Machine URL.
+ """
+ wayback_machine_url = wayback_machine_url.lower()
+
+ pattern = re.compile(r"/status/(\d+)")
+ match = pattern.search(wayback_machine_url)
+
+ if match and username in wayback_machine_url:
+ return f"https://web.archive.org/web/{archived_timestamp}/https://twitter.com/{username}/status/{match.group(1)}" # noqa: E501
+ else:
+ return wayback_machine_url
+
+
+def check_pattern_tweet(tweet_url):
+ """
+ Extracts tweet IDs from various types of tweet URLs or tweet-related patterns.
+
+ Reply pattern: /status//
+ Link pattern: /status///
+ Twimg pattern: /status/https://pbs
+ """
+ pattern = re.compile(r'/status/"([^"]+)"')
+
+ match = pattern.search(tweet_url)
+ if match:
+ return match.group(1).lstrip("/")
+ else:
+ return tweet_url
+
+
+def delete_tweet_pathnames(tweet_url):
+ """Removes any pathnames (/photos, /likes, /retweet...) from the tweet URL."""
+ pattern_username = re.compile(r"https://twitter\.com/([^/]+)/status/\d+")
+ match_username = pattern_username.match(tweet_url)
+
+ pattern_id = r"https://twitter.com/\w+/status/(\d+)"
+ match_id = re.search(pattern_id, tweet_url)
+
+ if match_id and match_username:
+ tweet_id = match_id.group(1)
+ username = match_username.group(1)
+ return f"https://twitter.com/{username}/status/{tweet_id}"
+ else:
+ return tweet_url
+
+
+def check_double_status(wayback_machine_url, original_tweet_url):
+ """
+ Checks if a Wayback Machine URL contains two occurrences of "/status/"
+ and if the original tweet does not contain "twitter.com".
+ Returns a boolean.
+ """
+ if (
+ wayback_machine_url.count("/status/") == 2
+ and "twitter.com" not in original_tweet_url
+ ):
+ return True
+
+ return False
+
+
+def semicolon_parser(string):
+ """Replaces semicolons in a string with %3B."""
+ return "".join("%3B" if c == ";" else c for c in string)
+
+
+def parse_date(ctx=None, param=None, value=None):
+ """
+ Parses a date string and returns it in the format "YYYYMMDD".
+
+ This function takes an optional date string as input,
+ and if a date string is provided, it parses the date string into a datetime object
+ and then formats it in the "YYYYMMDD" format.
+
+ Args:
+ ctx (None, optional): Necessary when used with the click package.
+ Defaults to None.
+ param (None, optional): Necessary when used with the click package.
+ Defaults to None.
+ value (str, optional): A date string in the "YYYYMMDD" format. Defaults to None.
+
+ Returns:
+ str: The input date string formatted in the "YYYYMMDD" format,
+ or None if no date string was provided.
+ """
+ if value is None:
+ return None
+
+ date = datetime.strptime(value, "%Y%m%d")
+ return date.strftime("%Y%m%d")
+++ /dev/null
-# flake8: noqa: E501
-import json
-
-
-class HTMLTweetsVisualizer:
- """Generates an HTML file to visualize the parsed data."""
-
- def __init__(self, json_file_path, html_file_path, username):
- self.json_content = self.json_loader(json_file_path)
- self.html_file_path = html_file_path
- self.username = username
-
- @staticmethod
- def json_loader(json_file_path):
- """Reads and loads JSON data from a specified file path."""
- with open(json_file_path, "r", encoding="utf-8") as f:
- return json.load(f)
-
- def generate(self):
- """Generates an HTML file."""
-
- html = f"<html>\n<head>\n<title>@{self.username} archived tweets</title>\n"
- html += "<style>\n"
- html += "body { font-family: monospace; background-color: #f5f8fa; color: #1c1e21; margin: 0; padding: 20px; }\n"
- html += ".container { display: flex; flex-wrap: wrap; gap: 20px; }\n"
- html += ".tweet { flex: 0 1 calc(33.33% - 20px); background-color: #fff; border: 1px solid #e1e8ed; border-radius: 10px; padding: 15px; overflow-wrap: break-word; margin: auto; }\n"
- html += ".tweet strong { font-weight: bold; }\n"
- html += ".tweet a { color: #ef5552; text-decoration: none; }\n"
- html += ".content { color: #ef5552; }\n"
- html += ".tweet a:hover { text-decoration: underline; }\n"
- html += "h1, h3 { text-align: center; }\n"
- html += "iframe { width: 600px; height: 600px; }\n"
- html += "</style>\n"
- html += "</head>\n<body>\n"
- html += f"<h1>@{self.username} archived tweets</h1>\n"
- html += '<div class="container">\n'
-
- for tweet in self.json_content:
- html += '<div class="tweet">\n'
-
- if (
- (
- tweet["archived_mimetype"] != "application/json"
- and not tweet["parsed_tweet_text_mimetype_json"]
- )
- and not tweet["available_tweet_text"]
- ) or (
- (
- tweet["archived_mimetype"] == "application/json"
- and not tweet["parsed_tweet_text_mimetype_json"]
- )
- and not tweet["available_tweet_text"]
- ):
- html += f'<iframe src="{tweet["parsed_archived_tweet_url"]}" frameborder="0" scrolling="auto"></iframe>\n'
-
- html += f'<p><a href="{tweet["original_tweet_url"]}" target="_blank"><strong>Original Tweet↗</strong></a> · \n'
- html += f'<a href="{tweet["parsed_tweet_url"]}" target="_blank"><strong>Parsed Tweet↗</strong></a> · \n'
- html += f'<a href="{tweet["archived_tweet_url"]}" target="_blank"><strong>Archived Tweet↗</strong></a> · \n'
- html += f'<a href="{tweet["parsed_archived_tweet_url"]}" target="_blank"><strong>Parsed Archived Tweet↗</strong></a></p>\n'
-
- if tweet["available_tweet_text"]:
- html += "<br>\n"
- html += f'<p><strong class="content">Available Tweet Content:</strong> {tweet["available_tweet_text"]}</p>\n'
- html += f'<p><strong class="content">Available Tweet Is Retweet:</strong> {tweet["available_tweet_is_RT"]}</p>\n'
- html += f'<p><strong class="content">Available Tweet Username:</strong> {tweet["available_tweet_info"]}</p>\n'
-
- if (
- tweet["archived_mimetype"] == "application/json"
- and tweet["parsed_tweet_text_mimetype_json"]
- ) and not tweet["available_tweet_text"]:
- html += f'<p><strong class="content">Parsed Tweet Text (application/json):</strong> {tweet["parsed_tweet_text_mimetype_json"]}</p>\n'
-
- html += "<br>\n"
- html += f'<p><strong>Archived URL Key:</strong> {tweet["archived_urlkey"]}</p>\n'
- html += f'<p><strong>Archived Timestamp:</strong> {tweet["archived_timestamp"]}</p>\n'
- html += f'<p><strong>Archived mimetype:</strong> {tweet["archived_mimetype"]}</p>\n'
- html += f'<p><strong>Archived Statuscode:</strong> {tweet["archived_statuscode"]}</p>\n'
- html += (
- f'<p><strong>Archived Digest:</strong> {tweet["archived_digest"]}</p>\n'
- )
- html += (
- f'<p><strong>Archived Length:</strong> {tweet["archived_length"]}</p>\n'
- )
- html += "</div>\n"
-
- html += "</div>\n"
- html += '<h3>generated by <a href="https://github.com/claromes/waybacktweets" target="_blank">Wayback Tweets↗</a></h3>\n'
- html += "</body>\n</html>"
-
- return html
-
- def save(self, html_content):
- """Saves the generated HTML."""
- with open(self.html_file_path, "w", encoding="utf-8") as f:
- f.write(html_content)