-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d3bab9b
commit af37374
Showing
1 changed file
with
88 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,88 @@ | ||
|
||
from bs4 import BeautifulSoup | ||
import requests | ||
import os | ||
import shutil | ||
import zipfile | ||
|
||
|
||
def get_download_specs(): | ||
|
||
#faz requst do html do site | ||
main_website = BeautifulSoup( | ||
|
||
requests.get('http://leagueskin.net/p/download-mod-skin-2020-chn').text, | ||
features="html.parser" | ||
) | ||
|
||
#pega o link de download | ||
href_from_button = main_website.find( | ||
'a', | ||
attrs={ | ||
'id': 'link_download3' | ||
} | ||
)['href'] | ||
|
||
|
||
#pega o patch com DOM junto com uma manipulaçao de str | ||
patchName_from_button = main_website.find( | ||
'button', | ||
attrs={ | ||
'id': 'name_button_download3' | ||
} | ||
).text.split(' ') | ||
|
||
try: | ||
while True: | ||
patchName_from_button.remove('') | ||
except ValueError: | ||
pass | ||
|
||
patchName_from_button = patchName_from_button[3] | ||
|
||
|
||
return [href_from_button, patchName_from_button] | ||
|
||
|
||
|
||
|
||
def update(): | ||
|
||
path = r'C:\\Fraps\\temp\\' | ||
|
||
#arruma os diretorios apagando se já existe e criando se ainda nao existe | ||
try: | ||
shutil.rmtree(path) | ||
except: | ||
os.makedirs(path) | ||
dir_path = True | ||
else: | ||
dir_path = False | ||
|
||
if not dir_path: | ||
os.makedirs(path) | ||
|
||
#cria request pra baixar o bag | ||
print('Updating Modskin LOLPRO...') | ||
download_specs = get_download_specs() | ||
donwload = requests.get(download_specs[0], allow_redirects=True) | ||
|
||
open(path+'file.zip', 'wb').write(donwload.content) | ||
with zipfile.ZipFile(path+'file.zip',"r") as zip_ref: | ||
|
||
#extrai o zip | ||
zip_ref.extractall(path) | ||
|
||
#apaga o zip | ||
os.remove(f'{path}file.zip') | ||
try: | ||
#liga o exec da atualização nova | ||
os.startfile(f'{path}LOLPRO {download_specs[1]}.exe') | ||
except: | ||
pass | ||
|
||
#box | ||
######### | ||
# | ||
update()# | ||
# | ||
######### |