Advertisement
shutdown57

Twitter image grabber

Oct 7th, 2017
370
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.74 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # coded by shutdown57
  4.  
  5. echo -n "Twitter : "
  6. read med
  7. echo "Loading ...."
  8. wget https://twitter.com/$med/media -O shutdown57.twitter.temp > /dev/null 2>&1
  9. echo "getting page media ... "
  10. sleep 1
  11. if [[ -f "shutdown57.twitter.temp" ]]; then
  12.     lo=`cat shutdown57.twitter.temp | grep -Po "https:\/\/pbs.twimg.com\/media\/(.*)\.jpg"`
  13.     n=1
  14.     echo "Creating directory result ..."
  15.     mkdir $med
  16.     for tw in $lo
  17.     do
  18.         IFS="/" read -r -a img <<< "$tw"
  19.         nama=${img[4]}
  20.         if [[ -f $med/$nama ]]; then
  21.             echo ""
  22.         else
  23.             echo "shutdown57 : "$tw" Downloading ... "
  24.             wget $tw -O $med/$nama > /dev/null 2>&1
  25.             if [[ -f $med/$nama ]]; then
  26.                 echo "shutdown57 : "$med"/"$nama" Saved !"
  27.             fi
  28.         fi
  29.  
  30.     done
  31.     rm shutdown57.twitter.temp
  32. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement