I am trying to fetch some lyrics from genius.com (i know they have an api.I am doing it manually.) but i dont seem to be getting the same html string everytime.In fact i put the code below in a for loop and it seems to be working only %50 of the time.
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import java.io.IOException;
public class Fetch_lyrics {
public static void testing() {
try {
String urll = "https://genius.com/In-mourning-debris-lyrics";;
Document doc = Jsoup.connect(urll).maxBodySize(0).get();
String text = doc.select("p").first().toString();
System.out.println(text);
} catch (IOException e) {
e.printStackTrace();
}
}
}
I printed the raw html via doc variable and it seems that around 50% of the time the raw html string doesn't have the <p>
class(idk if it's called class or something else) that contains the lyrics.Thanks in advance.