mirror of
https://github.com/RafaelSolVargas/Vulkan.git
synced 2025-10-29 16:57:23 +00:00
Integrating SpotifySearcher and Searcher
This commit is contained in:
parent
93046da491
commit
7775f259af
@ -33,11 +33,8 @@ class Searcher():
|
|||||||
if "https://www.youtu" in music or "https://youtu.be" in music:
|
if "https://www.youtu" in music or "https://youtu.be" in music:
|
||||||
return Provider.YouTube
|
return Provider.YouTube
|
||||||
|
|
||||||
if "https://open.spotify.com/track" in music:
|
if "https://open.spotify.com" in music:
|
||||||
return Provider.Spotify
|
return Provider.Spotify
|
||||||
|
|
||||||
if "https://open.spotify.com/playlist" in music or "https://open.spotify.com/album" in music:
|
|
||||||
return Provider.Spotify_Playlist
|
|
||||||
|
|
||||||
# If no match
|
# If no match
|
||||||
return Provider.Unknown
|
return Provider.Unknown
|
||||||
|
|||||||
@ -86,9 +86,8 @@ class SpotifySearch():
|
|||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
return musicsTitle
|
return musicsTitle
|
||||||
except:
|
except Exception as e:
|
||||||
if config.SPOTIFY_ID != "" or config.SPOTIFY_SECRET != "":
|
raise e
|
||||||
print("ERROR: Check spotify CLIENT_ID and SECRET")
|
|
||||||
|
|
||||||
def __get_playlist(self, code) -> list:
|
def __get_playlist(self, code) -> list:
|
||||||
"""Get the externals urls of a playlist
|
"""Get the externals urls of a playlist
|
||||||
@ -114,12 +113,10 @@ class SpotifySearch():
|
|||||||
titles.append(title)
|
titles.append(title)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise e
|
raise e
|
||||||
|
|
||||||
return titles
|
return titles
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
if config.SPOTIFY_ID != "" or config.SPOTIFY_SECRET != "":
|
|
||||||
print("ERROR: Check spotify CLIENT_ID and SECRET")
|
|
||||||
else:
|
|
||||||
raise e
|
raise e
|
||||||
|
|
||||||
def __get_track(self, code) -> list:
|
def __get_track(self, code) -> list:
|
||||||
@ -150,18 +147,3 @@ class SpotifySearch():
|
|||||||
"""(Experimental) - Convert the external_url link to the title of music using browser"""
|
"""(Experimental) - Convert the external_url link to the title of music using browser"""
|
||||||
title = self.__browser(url)
|
title = self.__browser(url)
|
||||||
return title
|
return title
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
spSearch = SpotifySearch()
|
|
||||||
spSearch.connect()
|
|
||||||
|
|
||||||
lista = spSearch.search(
|
|
||||||
'https://open.spotify.com/track/7wpnz7hje4FbnjZuWQtJHP')
|
|
||||||
lista2 = spSearch.search(
|
|
||||||
'https://open.spotify.com/album/6wEkHIUHNb1kZiV2nCnVoh')
|
|
||||||
lista3 = spSearch.search(
|
|
||||||
'https://open.spotify.com/playlist/5DOtjJ6rSMddAKyStv7Yc7?si=v893Wv0VSyuh0PokQvC8-g&utm_source=whatsapp')
|
|
||||||
print(lista3)
|
|
||||||
print(lista2)
|
|
||||||
print(lista)
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user