Skip to content

Instantly share code, notes, and snippets.

@vjo
Last active August 19, 2016 18:53
Show Gist options
  • Save vjo/7b4443b7f5e49ee65fa72aa13aaa807c to your computer and use it in GitHub Desktop.
Save vjo/7b4443b7f5e49ee65fa72aa13aaa807c to your computer and use it in GitHub Desktop.
Get Twitter user id from command line using twurl and jq
#!/bin/bash
if [ $# -eq 0 ] || [ $1 == "-h" ] || [ $1 == "--help" ]; then
echo 'Usage: userid <comma,separated,handles>'
echo 'Options:'
echo '-h, --help Show help'
exit 0
fi
twurl --request 'GET' '/1.1/users/lookup.json?screen_name='$1 | jq '.[] | {user_id: .id, screen_name: .screen_name}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment