URI:
       timgurfetch - scripts - random scripts
  HTML git clone https://git.parazyd.org/scripts
   DIR Log
   DIR Files
   DIR Refs
       ---
       timgurfetch (439B)
       ---
            1 #!/bin/sh
            2 # fetch an imgur album in the current dir
            3 
            4 case "$1" in
            5         http*://*imgur.com/a/*) ;;
            6         *)
            7                 printf "invalid imgur link\n"
            8                 exit 1
            9                 ;;
           10 esac
           11 
           12 vids="$(wget --quiet -O - "$1" | awk -F'"' '/meta itemprop="contenURL"/ {print $4}')"
           13 
           14 if [ -n "$vids" ]; then
           15         printf "%s\n" "$vids" | xargs wget
           16 else
           17         imgs="$(wget --quiet -O - "$1" | awk -F'"' '/contentURL/ {print "https:"$2}')"
           18         [ -n "$imgs" ] && printf "%s\n" "$imgs" | xargs wget
           19 fi