Skip to content

Instantly share code, notes, and snippets.

@rolandcrosby
Created December 2, 2018 22:46
Show Gist options
  • Save rolandcrosby/b7762abe911417758df9dceac3eb3ea6 to your computer and use it in GitHub Desktop.
Save rolandcrosby/b7762abe911417758df9dceac3eb3ea6 to your computer and use it in GitHub Desktop.
get recent media posted by a twitter user
#!/bin/bash
set -eu
set -o pipefail
screen_name=$1
twurl "/1.1/statuses/user_timeline.json?screen_name=$screen_name&trim_user=true&exclude_replies=true&count=200&include_rts=false" |
jq -r '.[]
| select(.extended_entities.media != null)
| .id_str as $tweet_id
| .extended_entities.media
| .[]
| .id_str as $media_id
| ("curl \"" + .media_url_https + "\" -o \"" + $tweet_id + "_" + $media_id + ".jpg\"" )' |
bash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment