shortlinks (645B)
1 #!/usr/bin/env bash 2 3 # Dependency 4 # <https://github.com/ericchiang/pup> 5 6 # Short URL command example 7 # curl -v "http://x.soucy.cc/?save=y&url=https://words.werd.io/tear-down-the-new-institutions-91516b868a2c" 8 9 # curl -s "http://x.soucy.cc/?save=y&url=https://words.werd.io/tear-down-the-new-institutions-91516b868a2c" | pup '[name="tighturl"] attr{value}' 10 11 while read -r db_entry; do 12 field_permalink=$(echo $db_entry | cut -d "|" -f 3) 13 14 field_shortlink=$(curl -s "http://x.soucy.cc/?save=y&url=$field_permalink" | pup '[name="tighturl"] attr{value}') 15 16 echo "$field_permalink|$field_shortlink" 17 18 done < fakestache.db > shortlinks.db 19