'How to automate a Valorant Rank tracker
I am trying to read out the current in-game names and tags of the players in-game and save them in a String, to automatically get their ranks with my following code. Is this somehow possible?
My current program can read out the rank of a player by manually inputting their in-game name and tag.
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.net.URL;
import java.util.Scanner;
public class ReadWebsite {
public static void main(String[] args) throws IOException {
UserInformations uI = new UserInformations();
Scanner scanName = new Scanner(System.in);
while (true) {
System.out.println("Abbruch (j/n): ");
String abbruchJN = scanName.nextLine();
if (abbruchJN.equalsIgnoreCase("j")) {
break;
}
System.out.println("Ingamename: ");
uI.setName(scanName.nextLine());
System.out.println("Tag: ");
uI.setTag(scanName.nextLine());
PrintWriter print = new PrintWriter(
new FileWriter("C:/Users/lukas/eclipse-workspace/Website-Reader/output/websiteOutput.txt"));
URL url = new URL(
"https://tracker.gg/valorant/profile/riot/" + uI.getName() + "%23" + uI.getTag() + "/overview");
String rank = "";
String kd = "";
String line = "";
Scanner scan = new Scanner(url.openStream(), "UTF-8");
while (scan.hasNextLine()) {
line = scan.nextLine();
if (line.contains("highlighted highlighted--giants")) {
rank = scan.nextLine();
System.out.println("Deine Rank ist : " + rank.trim() + ".");
}
print.println(scan.nextLine());
}
}
scanName.close();
}
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
