Last active
October 4, 2022 07:53
-
-
Save hubgit/d9cf2c23b9c31ab50c6c3510e7b3825e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<title>Twitter Archive Viewer</title> | |
<script>window.YTD = { tweet: {} }</script> | |
<script src="tweet.js"></script><!-- this is loading a file from the archive --> | |
<style> | |
.tweet { border: 1px solid #eee; margin: 8px } | |
.full_text { padding: 8px } | |
.created_at { padding: 8px; color: #777 } | |
</style> | |
<body> | |
<div id="root"></div> | |
<script> | |
const tweets = [] | |
for (const part of Object.values(window.YTD.tweet)) { | |
tweets.push(...part) | |
} | |
const newestFirst = (a, b) => new Date(b.created_at) - new Date(a.created_at) | |
const renderTweet = tweet => ` | |
<div class="tweet"> | |
<div class="full_text">${tweet.full_text}</div> | |
<div class="created_at">${tweet.created_at}</div> | |
</div>` | |
document.getElementById('root').innerHTML = tweets.sort(newestFirst).map(renderTweet).join('\n') | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks @frozenpandaman, that one worked for me too.