biird 601 Bytes
Newer Older
1 2
#!/bin/sh
# Download images in a Twitter post
ysh's avatar
ysh committed
3
[ -z "$1" ] && printf "usage: biird URL\n" && exit 0
4 5 6 7

number=$(curl -sL -o /dev/null -w %{url_effective} "$1" \
	| cut -d/ -f6 )
curl -s -H 'Authorization: Bearer AAAAAAAAAAAAAAAAAAAAAFZ2EwEAAAAATWDhyMLlRYX4PIuVbtUlandVHk8%3DE8NAxE8w8bzbAzFDfItKnbUHQYoxb5LqpA7UqaatDIXwPZtKz5' \
ysh's avatar
ysh committed
8
	    "https://api.twitter.com/1.1/statuses/show.json?id=$number&tweet_mode=extended" \
ysh's avatar
ysh committed
9 10
	| jq -r '.extended_entities.media[].media_url_https' \
	| sed 's/$/?name=orig/' \
11
	| aria2c -i - --auto-file-renaming=false \
12 13 14 15
	| awk -F': ' '
		/Download complete:/ {
			print $(NF)
		}'
16