~cadence/bibliogram

ref: d660c849411808d12f8ab75beac87d633491c6e2 bibliogram/src/site/api/utils/unblock.sh -rw-r--r-- 921 bytes
d660c849Cadence Ember Fix shortcode fetching 1 year, 28 days ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# Good on you for looking at shell scripts before blindly running them.
# This script contacts Instagram to get the profile's user ID, then sends the ID to Bibliogram. Bibliogram can take over from there.

# Make a temporary directory
tempdir=$(mktemp -d) || exit 1

# Try to request from Instagram
curl 'https://www.instagram.com/<username>/' -Ss > $tempdir/page.html

if test -s $tempdir/page.html; then
	# Request returned a page (file not empty)
	grep -oE '"id":"[0-9]+"' $tempdir/page.html | head -n 1 | grep -oE '[0-9]+' | curl --data-urlencode 'username=<username>' --data-urlencode 'user_id@-' '<website_origin>/api/suggest_user/v1?plaintext=1'
else
	# Request was a redirect
	echo "Your network is blocked by Instagram."
	echo "You won't be able to unblock any more profiles."
	echo "To be unblocked, wait a few hours without running this script."
fi

# Clean up, safely.
rm -f $tempdir/page.html
rm -d $tempdir