Closed Kudzmat closed 3 months ago
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
Thanks, man, this looks like a great solution to the problem!
Closing as it appears that your issue has been resolved.
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.