[p]play does not accept spotify links with regional codes #6446
Labels
No labels
Automated PR
Blocked
Blocked By: Damage Control
Blocked By: Dependency
Blocked By: Other PR
Breaking Change
Category: CI
Category: Cogs - Admin
Category: Cogs - Alias
Category: Cogs - Audio
Category: Cogs - Bank
Category: Cogs - Cleanup
Category: Cogs - CustomCommands
Category: Cogs - Dev
Category: Cogs - Downloader
Category: Cogs - Economy
Category: Cogs - Filter
Category: Cogs - General
Category: Cogs - Image
Category: Cogs - Mod
Category: Cogs - Modlog
Category: Cogs - Mutes
Category: Cogs - Permissions
Category: Cogs - Reports
Category: Cogs - Streams
Category: Cogs - Trivia
Category: Cogs - Trivia - Lists
Category: Cogs - Warnings
Category: Core - API - App Commands Package
Category: Core - API - Audio
Category: Core - API - Bank
Category: Core - API - Commands Package
Category: Core - API - Config
Category: Core - API - Other
Category: Core - API - Utils Package
Category: Core - Bot Class
Category: Core - Bot Commands
Category: Core - Command-line Interfaces
Category: Core - Downloader
Category: Core - Help
Category: Core - i18n
Category: Core - Modlog
Category: Core - Other Internals
Category: Core - RPC/ZMQ
Category: Docker
Category: Docs - Changelogs
Category: Docs - For Developers
Category: Docs - Install Guides
Category: Docs - Other
Category: Docs - User Guides
Category: Meta
Category: RPC/ZMQ methods
Category: Vendored Packages
Changelog Entry: Added
Changelog Entry: Pending
Changelog Entry: Skipped
Closed: Duplicate
Closed: External
Closed: Invalid
Closed: User Error
Closed: Won't Fix
Complex Issue
Docs-only
Feature Branch
Good First Issue
Help Wanted
High Priority
Needs Backport To stable-docs
No Activity
No Repro
QA: Bypassed
QA: Changes Requested
QA: Passed
Release Blocker
Status: Accepted
Status: Frozen
Status: In Progress
Status: Needs Discussion
Status: Needs Info
Status: Needs Triage
Status: PRs Welcome
Type: Bug
Type: Dependency Update
Type: Deprecation
Type: Enhancement
Type: Feature
Type: Informational
Type: Merge
Type: Optimisation
Type: Question
Type: Removal
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Mrcoolgamer11/Red-DiscordBot#6446
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
When a link contains an
/intl-XXcode (iehttps://open.spotify.com/intl-it/track/6KmrCHbuNOsdoeDOpwetr7?si=5314fcead96a4042,https://open.spotify.com/intl-es/track/6CIMoDfTsvFVGhFi3v9Izn?si=acea235e19c74922, etc), Audio raises an error and fails to play the track. This can be fixed by simply removing the/intl-XXportion of the URL. Logic to do this automatically should be added to the spotify track interpretation logic of Audio.Original issue below:
What Red version are you using?
3.5.13
What were you trying to do?
Trying to listen some music using Spotify links
What did you expect to happen?
Start the music
What actually happened?
Nothing, except error on console
[2024-09-05 00:28:12] [INFO] discord.client: logging in using static token
[2024-09-05 00:28:13] [INFO] red: Loading packages...
[2024-09-05 00:28:14] [ERROR] red.core.cogs.Streams: Twitch OAuth2 API request failed with status code 400 and error message: missing client id
[2024-09-05 00:28:14] [INFO] red: Loaded packages: permissions, admin, alias, audio, cleanup, customcom, downloader, economy, filter, general, image, mod, modlog, mutes, reports, streams, trivia, warnings
[2024-09-05 00:28:15] [INFO] discord.gateway: Shard ID 0 has connected to Gateway (Session ID: 7abdb0e66d8351927cde110f0bc14d8b).
[2024-09-05 00:28:15] [INFO] red: Connected to Discord. Getting ready...
[2024-09-05 00:28:18] [INFO] red.Audio.manager: Managed Lavalink node startup command: 'C:\Program Files\Java\jdk-17\bin\java.exe' -Xms64M -Xmx7G -jar 'C:\Users\Server\AppData\Local\Red-DiscordBot\cogs\Audio\Lavalink.jar'
[2024-09-05 00:28:18] [INFO] red.Audio.manager: Managed Lavalink node started. PID: 12088
[2024-09-05 00:28:18] [INFO] red.Audio.manager: Waiting for Managed Lavalink node to be ready
[2024-09-05 00:28:25] [INFO] red.Audio.manager: Managed Lavalink node is ready to receive requests.
[2024-09-05 00:28:25] [INFO] red.Audio.WS.LLNode: Lavalink WS connecting to ws://localhost:2333 with headers {'Authorization': 'youshallnotpass', 'User-Id': '1194401660861157557', 'Num-Shards': '1', 'Client-Name': 'Red-Lavalink/0.11.0', 'Resume-Key': 'Red-Core-Audio-1194401660861157557-YTBot'}
[2024-09-05 00:28:27] [INFO] red.Audio.WS.LLNode: Lavalink WS connected to ws://localhost:2333
[2024-09-05 00:28:45] [ERROR] red: KeyError
Traceback (most recent call last):
File "C:\Users\Server\redenv\Lib\site-packages\discord\ext\commands\core.py", line 235, in wrapped
ret = await coro(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Server\redenv\Lib\site-packages\redbot\cogs\audio\core\commands\player.py", line 128, in command_play
return await self._get_spotify_tracks(ctx, query)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Server\redenv\Lib\site-packages\redbot\cogs\audio\core\utilities\player.py", line 283, in _get_spotify_tracks
raise e
File "C:\Users\Server\redenv\Lib\site-packages\redbot\cogs\audio\core\utilities\player.py", line 262, in _get_spotify_tracks
res = await self.api_interface.spotify_query(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Server\redenv\Lib\site-packages\redbot\cogs\audio\apis\interface.py", line 392, in spotify_query
urls = await self.fetch_spotify_query(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Server\redenv\Lib\site-packages\redbot\cogs\audio\apis\interface.py", line 223, in fetch_spotify_query
) = await self.spotify_api.get_spotify_track_info(track, ctx)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Server\redenv\Lib\site-packages\redbot\cogs\audio\apis\spotify.py", line 67, in get_spotify_track_info
track_name = track_data["name"]
~~~~~~~~~~^^^^^^^^
KeyError: 'name'
How can we reproduce this error?
1.Start the bot
2.Use the command to add a song from spotify (%play https://open.spotify.com/intl-it/track/6KmrCHbuNOsdoeDOpwetr7?si=5314fcead96a4042)
Anything else?
No response
It looks like your link might be bad. I just tried that exact song through your link, no luck. If I go to Spotify and copy the same song and do it, the player works fine. Try this: https://open.spotify.com/track/6KmrCHbuNOsdoeDOpwetr7?si=e5ba859759ca498e
Yeah, you are right. Mine has /intl-it/, your doesn't. I tried now and is working and Spotify now is giving the same link as you.
Idk why was giving the link like that
Just a quick note: I also copied a link from spotify vie their desktop GUIs menu to share links and it also produces an /intl-de/ URL. This URL does not work with [p]play . When submitting the command it shows only a spotify widget but nothing happens. I have to remove the "/intl-de" section of the URL to make it work. Not sure if this is a geolocation thingy indicated by the "-de" part of the URL or if there was a general change in URL scheme.
If there is any information I can supply to troubleshoot, please let me know. :)
Thanks for yout great work and have a nice weekend!
Yes, that's what my comment was indicating...