Bulk convert Twitter IDs to usernames without Twitter API
I recently decided to wipe out my Twitter profile and downloaded an archive of my data. It turns out the archive only includes a big list of permanent Twitter user IDs but I needed the corresponding usernames in order to obtain RSS feeds from nitter.net.
Getting the username is as easy as following what this URL redirects to: twitter.com/intent/user?user_id=<ID>. But doing this is bulk means using the Twitter API in some way which requires verifying your phone number and I didn't want to deal with credentials for this temporary task.
Meanwhile, I found tweeterid.com. It allows you to convert Twitter IDs to screen names but you have to do it one by one.
Inspecting the network tab in the developer console, I found that it makes a POST request to https://tweeterid.com/ajax.php with the data input=<ID>. I made a file named twids with each line containing one ID, and ran the following command in my terminal. It takes each line of twids file, makes a POST request with the data, and writes out the response to stdout separated by newline characters.
xargs -I {} curl -s -d 'input={}' 'https://tweeterid.com/ajax.php' -w '\n' < twids