From: Claromes Date: Tue, 4 Jun 2024 22:09:20 +0000 (-0300) Subject: update html X-Git-Url: https://git.claromes.com/?a=commitdiff_plain;h=2b5450e48cf486878a13322e3161d61d255ddbe3;p=waybacktweets.git update html --- diff --git a/waybacktweets/export_tweets.py b/waybacktweets/export_tweets.py index fcd648c..40b04e6 100644 --- a/waybacktweets/export_tweets.py +++ b/waybacktweets/export_tweets.py @@ -46,7 +46,6 @@ class TweetsExporter: data_transposed = self.transpose_matrix(self.data) df = pd.DataFrame(data_transposed, columns=self.metadata_options) - df = df.sort_values(by="archived_timestamp", ascending=self.ascending) return df diff --git a/waybacktweets/main.py b/waybacktweets/main.py index 66bdfb3..aa22037 100644 --- a/waybacktweets/main.py +++ b/waybacktweets/main.py @@ -34,9 +34,9 @@ def main(): exporter = TweetsExporter(parsed_tweets, username, metadata_options, ascending) - exporter.save_to_csv() + # exporter.save_to_csv() # exporter.save_to_json() - # exporter.save_to_html() + exporter.save_to_html() print( f'\nNeed help? Open an issue: https://github.com/claromes/waybacktweets/issues.' diff --git a/waybacktweets/viz_tweets.py b/waybacktweets/viz_tweets.py index ef14a38..ff19364 100644 --- a/waybacktweets/viz_tweets.py +++ b/waybacktweets/viz_tweets.py @@ -23,9 +23,11 @@ class HTMLTweetsVisualizer: 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: #1da1f2; text-decoration: none; }\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 { text-align: center; }\n' + html += 'h1, h3 { text-align: center; }\n' + html += 'iframe { width: 600px; height: 600px; }\n' html += '\n' html += '\n\n' html += f'

@{self.username} archived tweets

\n' @@ -33,23 +35,34 @@ class HTMLTweetsVisualizer: for tweet in self.json_content: html += '
\n' - html += f'

Archived Timestamp: {tweet["archived_timestamp"]}

\n' + + if tweet["archived_mimetype"] != 'application/json': + html += f'\n' + + html += f'

Original Tweet↗ · \n' + html += f'Parsed Tweet↗ · \n' + html += f'Archived Tweet↗ · \n' + html += f'Parsed Archived Tweet↗

\n' + + if tweet["available_tweet_text"]: + html += f'

Available Tweet Content: {tweet["available_tweet_text"]}

\n' + html += f'

Available Tweet Is Retweet: {tweet["available_tweet_is_RT"]}

\n' + html += f'

Available Tweet Username: {tweet["available_tweet_username"]}

\n' + + if tweet["archived_mimetype"] == 'application/json': + html += f'

Parsed Tweet Text (application/json): {tweet["parsed_tweet_text_mimetype_json"]}

\n' + + html += f'
\n' html += f'

Archived URL Key: {tweet["archived_urlkey"]}

\n' - html += f'

Tweet: {tweet["tweet"]}

\n' - html += f'

Archived Tweet: {tweet["archived_tweet"]}

\n' - html += f'

Parsed Tweet: {tweet["parsed_tweet"]}

\n' - html += f'

Parsed Tweet Mimetype JSON: {tweet["parsed_tweet_mimetype_json"]}

\n' - html += f'

Parsed Archived Tweet: {tweet["parsed_archived_tweet"]}

\n' - html += f'

Archived Mimetype: {tweet["archived_mimetype"]}

\n' + html += f'

Archived Timestamp: {tweet["archived_timestamp"]}

\n' + html += f'

Archived mimetype: {tweet["archived_mimetype"]}

\n' html += f'

Archived Statuscode: {tweet["archived_statuscode"]}

\n' html += f'

Archived Digest: {tweet["archived_digest"]}

\n' html += f'

Archived Length: {tweet["archived_length"]}

\n' - html += f'

Available Tweet Content: {tweet["available_tweet_content"]}

\n' - html += f'

Available Tweet Is Retweet: {tweet["available_tweet_is_RT"]}

\n' - html += f'

Available Tweet Username: {tweet["available_tweet_username"]}

\n' html += '
\n' html += '\n' + html += f'

generated by Wayback Tweets↗

\n' html += '\n' return html