drpanwe icon

romdownloader

drpanwe | PRO | 10/02/20 04:07:03 PM UTC | 0 ⭐ | 375 👁️ | Never ⏰ | []
Bash |

2.54 KB

|

None

|

0 👍

/

0 👎

#!/bin/bash
gamepage="$1" # e.g. https://vimm.net/vault/1169
 
if [ $# -eq 0 ]
  then
    echo "No arguments supplied. Example: ./script.sh https://vimm.net/vault/1169"
    exit 1
fi
 
# Find the mediaID
while true; do
  id=$(curl -s "$gamepage" | grep 'fileSize\[' | head -n 1 | cut -d \[ -f2 | cut -d \] -f1)
  if [ -z "$id" ]; then
      echo "\$id is empty. Retrying ..."
  else
      echo "\$id is $id"
      break
  fi
done
 
# Construct URL
URL="https://download.vimm.net/download/?mediaId=$id"
echo "Visiting $URL"
 
# Find the filename
while true; do
  filename=$(curl -s -D - \
     -H "Referer: https://vimm.net/" \
     -H "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36" \
     "$URL" | grep "Content-Disposition" | awk -F '=' '{print substr($2,2,length($2)-3)}')
   if [ -z "$filename" ]; then
    echo "\$filename is empty. Retrying ..."
   else
        echo "\$filename is $filename"
        break
   fi
done
 
# Download it
while true; do
  curl -s \
     -H "Referer: https://vimm.net/" \
     -H "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36" \
     "$URL" --output "$filename"
 
  # Test the file
  if test -f "$filename"; then
    echo "$filename has been downloaded"
    # Check if thefile is zip
    if file "$filename" | grep 'Zip archive data' &> /dev/null; then
      echo "$filename is a valid Zip archive"
      break
    else
      echo "$filename is not a zip archive. Retrying ..."
    fi
  else
    echo "$filename has not been downloaded. Retrying ..."
  fi
done
 
 
# Not needed Headers
#     -H "Cache-Control: max-age=0" \
#     -H "If-None-Match: \"add61c4fdac54d1a735088da4c743358\"" \
#     -H "Cookie: __cfduid=db8b88950e20f8a7abcd1a8c1e5c3f4ef1601646842" \
#     -H "DNT: 1" \
#     -H "Upgrade-Insecure-Requests: 1" \
#     -H "Sec-Fetch-User: ?1" \
#     -H "Sec-Fetch-Site: same-site" \
#     -H "Sec-Fetch-Mode: navigate" \
#     -H "Sec-Fetch-Dest: document" \
#     -H "Host: download.vimm.net" \
#     -H "Content-Type: application/zip" \
#     -H "Connection: keep-alive" \
#     -H "Accept-Language: en,en-DE;q=0.9,el-GR;q=0.8,el;q=0.7,de-DE;q=0.6,de;q=0.5,en-US;q=0.4" \
#     -H "Accept-Encoding: gzip, deflate, br" \
#     -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9" \
# curl -v --connect-timeout 5 -k -L \
 

Comments