Get unique pairs of DM IDs from your Twitter archive:
jq -r '.[] | .dmConversation.messages[] | [.messageCreate.recipientId, .messageCreate.senderId] | @csv' < direct-messages.json > dm-pairs.csv
Get all DM users:
{ xsv select -n 1 < dm-pairs.csv ; xsv select -n 2 < dm-pairs.csv; } | sort -u > dm-users.csv
Go to https://developer.twitter.com/en/docs/twitter-api/users/lookup/api-reference/get-users-id, click "Try a live request", then authorize oauth-playground.glitch.me
to your Twitter account.
Return to the page, open your browser's developer tools, and get the token
cookie and paste it into run.sh
, below. Then run:
mkdir users
./run.sh dm-users.csv
Finally, run resolve.sh
(parallel invocation below) to resolve profile URLs (shortened with t.co) to real ones:
parallel -j 8 ./resolve.sh ::: users/*.*
xsv
is https://github.com/BurntSushi/xsvjq
is https://stedolan.github.io/jq/parallel
is https://www.gnu.org/software/parallel/