@@ -31,6 +31,7 @@ def bible(lib):
3131from selenium .common .exceptions import WebDriverException
3232
3333
34+
3435def popen (cmd ):
3536 startupinfo = subprocess .STARTUPINFO ()
3637 startupinfo .dwFlags |= subprocess .STARTF_USESHOWWINDOW
@@ -45,7 +46,7 @@ def get_path_exe(exe_name, thirty_two=True):
4546 path_exe = None
4647 DISCO = popen ('echo %WINDIR%' ).decode ().split (':' )[0 ]
4748
48-
49+
4950 if thirty_two :
5051 path_program_files = rf'{ DISCO } :\Program Files (x86)'
5152 else :
@@ -63,11 +64,13 @@ def return_driver():
6364 Esta função baixa e retorna o driver no computador do usuário
6465 '''
6566
67+ if get_path_exe ('chrome.exe' , False ):
68+ return webdriver .Chrome (ChromeDriverManager ().install ())
69+
70+
6671 if get_path_exe ('msedge.exe' ):
6772 return webdriver .Edge (EdgeChromiumDriverManager ().install ())
6873
69- if get_path_exe ('chrome.exe' ):
70- return webdriver .Chrome (ChromeDriverManager ().install ())
7174
7275 print ("Você precisa ter o Google Chrome ou Edge instalado" )
7376 input ("" )
@@ -78,8 +81,14 @@ def links_zippyshare():
7881 soup = BeautifulSoup (driver .page_source , 'html.parser' )
7982 global lista_com_links
8083 lista_com_links = []
81- for link in soup .find_all (href = re .compile ('zippyshare.com' )):
84+
85+ for link in soup .find_all (href = re .compile ('/zippyshare/' )):
8286 lista_com_links .append (link ['href' ])
87+
88+ if len (lista_com_links ) == 0 :
89+ for link in soup .find_all (href = re .compile ('zippyshare.com' )):
90+ lista_com_links .append (link ['href' ])
91+
8392 return lista_com_links
8493
8594
@@ -180,17 +189,12 @@ def retornar_busca():
180189
181190 print ('Iniciando o download\n ' )
182191 driver .get (link )
183- sopa = BeautifulSoup (driver .page_source , 'html.parser' )
184- zip_link = sopa .find_all ("a" , id = True )
185- zip = zip_link [0 ].get ('href' )
186- picotado = str (link ).split ('/' )
187- episode = 'https://{}{}' .format (picotado [2 ], zip )
188-
189-
190- path_vlc = get_path_exe ("vlc.exe" , False )
192+ episode = driver .find_element_by_xpath ('//a[@id="dlbutton"]' ).get_attribute ('href' )
193+
191194
192- if path_vlc :
193- popen (f'"{ path_vlc } " { episode } ' )
195+ # path_vlc = get_path_exe("vlc.exe", False)
196+ # if path_vlc:
197+ # popen(f'"{path_vlc}" {episode}')
194198
195199 driver .get (episode )
196200
0 commit comments