Skip to content

Instantly share code, notes, and snippets.

@tdhopper
Created August 5, 2016 12:40
Show Gist options
  • Save tdhopper/fccc4ab00a07cb290f1812d8ac5cc5f3 to your computer and use it in GitHub Desktop.
Save tdhopper/fccc4ab00a07cb290f1812d8ac5cc5f3 to your computer and use it in GitHub Desktop.
Find your tweets from this date in earlier years.
# Find your tweets from this date in earlier years.
# OS X's date function doesn't have the required date math capabilities.
# This requires GNU date. You can get it on OS X with `brew install coreutils`
GDATE=/usr/local/bin/gdate
USERNAME=realDonaldTrump
export URL="https://twitter.com/search?q=from%3A$USERNAME%20("
for yearsago in {1..12}; do
# echo $URL
URL=$URL"(since%3A"$($GDATE '+%Y-%m-%d' -d "$yearsago year ago")"%20until%3A"$($GDATE '+%Y-%m-%d' -d "$($GDATE '+%Y-%m-%d' -d "$yearsago year ago") 1 day")")%20OR%20";
done;
open $URL")"