Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Recover your Twitter threads from your Twitter export data
$tweetJson = (Get-Content .\tweets.js -Raw).Substring("window.YTD.tweets.part0 =".Length)
$tweets = $tweetJson | ConvertFrom-Json
$currentThread = ""
foreach($currentTweetJson in $tweets)
{
$currentTweet = $currentTweetJson.tweet
if($currentTweet.in_reply_to_screen_name -eq "Lee_Holmes")
{
if($currentTweet.full_text -notmatch '@')
{
$currentThread = $currentTweet.full_text + "`r`n" + $currentThread
}
}
else
{
if($currentThread)
{
if($currentTweet.full_text -notmatch '@')
{
$currentThread = $currentTweet.full_text + "`r`n" + $currentThread
"-"*50
$currentThread
"-"*50
}
$currentThread = ""
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment