Skip to content

Instantly share code, notes, and snippets.

@bennyfactor
Last active November 18, 2022 03:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bennyfactor/72aa9d21965aa7cac36dd24081975d0a to your computer and use it in GitHub Desktop.
Save bennyfactor/72aa9d21965aa7cac36dd24081975d0a to your computer and use it in GitHub Desktop.
Get all those t.co links before they're gone forever
#!/bin/sh
# go to the base directory of your twitter archive, ie something like twitter-YYYY-MM-DD-deadbeefcafe42069
# run this for loop:
for i in `grep -oh "https://t.co/[[:alnum:]]*" data/*.js | sort | uniq`
do
echo $i $(curl -Is ${i} | grep location | sed -e 's/location./, /') | sed -e 's/ ,/,/' | tee -a tco.csv
done
# this will take ... a while. It will save them to a csv file called tco.csv.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment