I want to get text from a page, but it does not work. I use the following method to get the source code:
public void printSourceCode(){
URL url = new URL(page);
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(url.openStream()));
BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(new File("./output.txt"), true));
String line;
while((line = bufferedReader.readLine()) != null) {
bufferedWriter.append(line + "\n");
}
bufferedWriter.close();
}
The String variable "page" is equals to "https://ift.tt/3918Qb1" for example. My goal is to get the Discord name and tag hidden behind the Discord icon. I tried to achieve this by checking every line for the HTML class ( .contains("class=\"user-identity-stats\"") ). But somehow (I checked the text file) it does not read this part. It reads the page description and the patches on the right and the footer but that's it.
Why does it not appear and how can I fix it?
Thank you and have a nice weekend!
Edit: I tried it with https://www.view-page-source.com too but it's still hiding this part. When I activate the developer mode on my browser to see the source code I can see it though
Aucun commentaire:
Enregistrer un commentaire