-
Notifications
You must be signed in to change notification settings - Fork 1
Description
When calling the getLyrics method with a valid URL, an IndexOutOfBoundsException is thrown. Upon investigation, it appears that the issue stems from an attempt to locate an element in the HTML document returned by the URL. The CSS selector used in the getLyrics method relies on a class name that has recently changed on the Genius website, resulting in an empty list and an error when accessing index 0.
Steps to Reproduce:
Set up the library in the project.
Call the getLyrics method with the following sample URL:
https://genius.com/Dream-theater-outcry-lyrics
Observe the exception being thrown.
Stack Trace:
java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0
at ...
Root Cause:
In the getLyrics method, a CSS selector is used to fetch elements from the HTML document. Due to a recent change in the Genius website structure, the selector no longer matches the expected elements, resulting in an empty list. When the code attempts to access index 0 of this list, the exception is thrown.
Proposed Fix:
Update the CSS selector in the getLyrics method to align with the current structure of the Genius website.
Add checks to ensure the list returned by the selector is not empty before accessing indices.
Implement error handling to provide a clear message when the page structure does not match the expected format, facilitating future updates.
Impact:
This issue prevents the getLyrics method from functioning correctly, making it impossible to retrieve lyrics from valid Genius URLs.
Special Request:
I humbly ask that special attention be given to this issue, as I am actively developing a project that relies heavily on your library. Resolving this problem would greatly assist me in moving forward with my work. Thank you in advance for your time and support!