Guest User

autovk

a guest
Jul 31st, 2021
353
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.88 KB | None | 0 0
  1. #! /bin/bash
  2.  
  3. echo "paste link:"
  4. read link
  5.  
  6. loginTemp="$(cut -d '_' -f1 <<< "$link")"
  7. docTemp="$(cut -d '_' -f2 <<< "$link")"
  8. id="$(cut -d 'c' -f3 <<< "$loginTemp")"
  9. doc=$(($docTemp+1000))
  10.  
  11. filecount=0
  12. outcount=0
  13. SECONDS=0
  14.  
  15. while [ $doc -gt 0 ]
  16.  
  17. do
  18.     link="https://vk.com/doc"$id"_"$doc
  19.  
  20.     img_link=$(curl -s $link | grep img | grep -o src="\"http.*" | grep -o "http.*\"" | sed 's/\?.*//')
  21.  
  22.  
  23.     if [  -z $img_link ]
  24.     then
  25. #       if [ $(($outcount % 100)) -eq 0 ]
  26.         if [ $(($outcount % 1000)) -eq 0 ]
  27.         then
  28.  
  29. #           echo "${link} Found: ${filecount}"
  30.             duration=$SECONDS
  31.             echo "Item ${id} ${doc} Found: ${filecount} \
  32. Passed $(($duration / 3600)) h $((($duration / 60) % 60)) min $(($duration % 60)) sec"
  33.     fi
  34.     else   
  35.         echo "Got File"
  36.         filecount=$[$filecount+1]
  37.         echo $img_link >> links.txt
  38.         wget $img_link
  39.     fi
  40.     doc=$[$doc-1]
  41.     outcount=$[$outcount+1]
  42.     img_link=""
  43. done
  44.  
Advertisement
Add Comment
Please, Sign In to add comment