You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
65 lines
2.2 KiB
65 lines
2.2 KiB
import requests |
|
from requests_html import HTMLSession |
|
from time import sleep |
|
import re |
|
|
|
from pprint import pprint |
|
|
|
urlBase = "https://vimm.net/vault/" |
|
gameID = 6029 |
|
|
|
|
|
|
|
def gameInfo(gameId, urlBase): |
|
try: |
|
session = HTMLSession() |
|
response = session.get(url) |
|
if len(response.html.find('p')) == 0: |
|
# This part gets the game info |
|
gameConsole = response.html.find('h2')[0].text.split('\n')[0] |
|
gameTitle = response.html.find('h2')[0].text.split('\n')[1] |
|
inputs = response.html.find('input') |
|
for inputField in inputs: |
|
if inputField.html.find('mediaId') != -1: |
|
mediaID = re.findall('value=\"(.*?)\"', inputField.html)[0] |
|
print("Game: " + gameTitle + "\nURL: " + url + "\nMediaID: " + mediaID) |
|
print("\nFetching Game...\n") |
|
downloadGame(gameID, mediaID) |
|
print("Download complete!") |
|
else: |
|
print("There is no game with this ID") |
|
except requests.exceptions.RequestException as e: |
|
print(e) |
|
return |
|
|
|
|
|
def downloadGame(gameID, mediaID): |
|
headers = { |
|
"User-Agent": 'Mozilla/5.0(X11; Linux x86_64; rv: 83.0) ' |
|
'Gecko/20100101' |
|
'Firefox / 83.0', |
|
"Accept": 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8', |
|
"Accept-Language": 'en-US,en;q=0.5', |
|
"Accept-Encoding": 'gzip, deflate, br', |
|
"Connection": 'keep-alive', |
|
"Referer": 'https://vimm.net/vault/' + str(gameID), |
|
"Cookie": '__cfduid = d186e9398ba52f9caf7e9a1fdae8b51511606415231', |
|
"Upgrade-Insecure-Requests": '1', |
|
} |
|
try: |
|
# This part downloads the game |
|
r = requests.get("https://download4.vimm.net/download/?mediaId=" + str(mediaID), headers=headers) |
|
pprint(r) |
|
h = r.headers['content-disposition'] |
|
saveLocation = '/home/anthonyo/Downloads/' + re.findall("filename=(.+)", h)[0] |
|
open(saveLocation, 'wb').write(r.content) |
|
except requests.exceptions.RequestException as e: |
|
print(e) |
|
return |
|
|
|
|
|
while gameID != 6030: |
|
url = urlBase + str(gameID) |
|
gameInfo(gameID, urlBase) |
|
gameID += 1 |
|
sleep(2)
|
|
|