mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-04-27 00:25:54 +03:00
[GH-ISSUE #1006] Issue with Tags in Playlist Descriptions Causing HTML Rendering Problems #600
Labels
No labels
api-bug
bug
dependencies
documentation
duplicate
enhancement
external-ide
headless-mode
implicit-grant-flow
invalid
missing-endpoint
pr-welcome
private-api
pull-request
question
spotipy3
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/spotipy#600
Loading…
Add table
Add a link
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?
Originally created by @Kudzmat on GitHub (Jul 28, 2023).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/1006
Describe the bug
The .category_playlists() method in Spotipy is returning playlists with descriptions that contain HTML tags. While some descriptions render correctly, others have embedded HTML tags, causing issues when displaying playlists on HTML documents.
Here are two examples to illustrate the problem:
The pulse of R&B music today. Cover: Mahalia
This is R&B in Canada, elevate your aura with Roy Woods.
100% British - 100% R&B. Cover: Kali Claire
A collection R&B and Afropop cuts from West Africa’s finest artists. Cover: Chike
Enjoy trendy & chill Korean R&B music. (Cover: UNE(으네))
The best mix of today's Christian music, all genres, worldwide. Cover: Forrest Frank and Chandler Moore of Maverick City Music
Las canciones de fe que más se escuchan en Latinoamérica. Foto: Marcos Witt
Experience the powerful messages and sounds of the current hits and classic Gospel songs. Cover: The hosts of this year's Stellar Awards , Tasha Cobbs Leonard and Jonathan McReynolds
No need to wait! Experience today's best Worship music right here, right now, on Spotify. Cover: Passion
Get lifted by the waves of faith-infused music. Cover: Stellar Award winning artist Pastor Mike Jr..
code snippet
Python code snippet:
In the "bad" description, the presence of the tag results in the rendering of an anchor link that may lead to unintended behavior and disrupt the appearance of the playlist on HTML documents.
Expected Behavior
The .category_playlists() method should return playlist descriptions without any HTML tags or, alternatively, provide a sanitized version of the description suitable for direct rendering in HTML documents.
Steps to Reproduce
Call the .category_playlists() method with appropriate parameters to retrieve playlists.
Iterate through the playlist objects and access the description field.
Observe that some descriptions contain HTML tags while others do not.
Environment:
In conclusion
The presence of HTML tags in playlist descriptions makes it challenging to directly render playlists on web applications or HTML-based platforms. Please let me know if any further information is needed to resolve this bug.
@dieser-niko commented on GitHub (Aug 8, 2023):
The spotipy library just returns the content received from Spotify. The only modification is to convert the text to JSON. If you have trouble with the HTML tags and just want to remove them, you might want to take a look at this neat solution: https://stackoverflow.com/a/12982689
@Kudzmat commented on GitHub (Aug 10, 2023):
Thanks, man, this looks like a great solution to the problem!
@dieser-niko commented on GitHub (May 23, 2024):
Closing as it appears that your issue has been resolved.