Switch up search providers
This commit is contained in:
parent
8e84d9e11f
commit
2f088fab5d
@ -233,15 +233,22 @@ class Play(commands.Cog):
|
||||
|
||||
else:
|
||||
if not url_rx.match(query):
|
||||
ytsearch = f"ytsearch:{query}"
|
||||
results = await player.node.get_tracks(ytsearch)
|
||||
dzsearch = f"dzsearch:{query}"
|
||||
results = await player.node.get_tracks(dzsearch)
|
||||
|
||||
if not results.tracks or results.load_type in (
|
||||
LoadType.EMPTY,
|
||||
LoadType.ERROR,
|
||||
):
|
||||
dzsearch = f"dzsearch:{query}"
|
||||
results = await player.node.get_tracks(dzsearch)
|
||||
scsearch = f"scsearch:{query}"
|
||||
results = await player.node.get_tracks(scsearch)
|
||||
|
||||
if not results.tracks or results.load_type in (
|
||||
LoadType.EMPTY,
|
||||
LoadType.ERROR,
|
||||
):
|
||||
ytsearch = f"ytsearch:{query}"
|
||||
results = await player.node.get_tracks(ytsearch)
|
||||
else:
|
||||
results = await player.node.get_tracks(query)
|
||||
|
||||
|
@ -18,20 +18,27 @@ class CustomAudioTrack(DeferredAudioTrack):
|
||||
async def load(
|
||||
self, client
|
||||
): # Load our 'actual' playback track using the metadata from this one.
|
||||
ytsearch = f"ytsearch:{self.title} {self.author} audio"
|
||||
results = await client.get_tracks(ytsearch)
|
||||
dzsearch = f"dzsearch:{self.title} {self.author}"
|
||||
results = await client.get_tracks(dzsearch)
|
||||
if not results.tracks or results.load_type in (
|
||||
LoadType.EMPTY,
|
||||
LoadType.ERROR,
|
||||
):
|
||||
dzsearch = f"dzsearch:{self.title} {self.author}"
|
||||
results = await client.get_tracks(dzsearch)
|
||||
scsearch = f"scsearch:{self.title} {self.author}"
|
||||
results = await client.get_tracks(scsearch)
|
||||
|
||||
if not results.tracks or results.load_type in (
|
||||
LoadType.EMPTY,
|
||||
LoadType.ERROR,
|
||||
):
|
||||
raise LoadError
|
||||
ytsearch = f"ytsearch:{self.title} {self.author} audio"
|
||||
results = await client.get_tracks(ytsearch)
|
||||
|
||||
if not results.tracks or results.load_type in (
|
||||
LoadType.EMPTY,
|
||||
LoadType.ERROR,
|
||||
):
|
||||
raise LoadError
|
||||
|
||||
first_track = results.tracks[0] # Grab the first track from the results.
|
||||
base64 = first_track.track # Extract the base64 string from the track.
|
||||
|
Loading…
x
Reference in New Issue
Block a user