From e700953ebbe12d1af8d786eb9250e39ad5fc3ef5 Mon Sep 17 00:00:00 2001 From: Bryson Steck Date: Fri, 21 May 2021 07:36:58 -0600 Subject: fixed useragent issue in RoomData --- .../main/java/me/brysonsteck/wiimmfiwatcher/wiimmfi/RoomData.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'app/src/main/java/me') diff --git a/app/src/main/java/me/brysonsteck/wiimmfiwatcher/wiimmfi/RoomData.java b/app/src/main/java/me/brysonsteck/wiimmfiwatcher/wiimmfi/RoomData.java index 64afedc..47faf4b 100644 --- a/app/src/main/java/me/brysonsteck/wiimmfiwatcher/wiimmfi/RoomData.java +++ b/app/src/main/java/me/brysonsteck/wiimmfiwatcher/wiimmfi/RoomData.java @@ -8,11 +8,14 @@ import org.jsoup.select.Elements; import java.io.IOException; import java.util.ArrayList; +import me.brysonsteck.wiimmfiwatcher.BuildConfig; + public class RoomData { String roomHeader; String playerLink; String friendCode; ArrayList players = new ArrayList<>(); + String userAgent = "Wiimmfi Watcher for Android (https://github.com/brysonsteck/wiimmfi-watcher) Version " + BuildConfig.VERSION_NAME; public RoomData (ArrayList players, String friendCode) { this.friendCode = friendCode; @@ -24,8 +27,9 @@ public class RoomData { } else { try { + System.out.println(userAgent); doc = Jsoup.connect("https://wiimmfi.de/" + this.playerLink) - .userAgent("Wiimmfi Watcher for Android (https://github.com/brysonsteck/wiimmfi-watcher) (UNDER DEVELOPMENT)") + .userAgent(userAgent) .get(); } catch (IOException e) { e.printStackTrace(); @@ -92,7 +96,7 @@ public class RoomData { public void getPlayerLink() { try { Document doc = Jsoup.connect("https://wiimmfi.de/stats/mkw") - .userAgent("Wiimmfi Watcher for Android (https://github.com/brysonsteck/wiimmfi-watcher)") + .userAgent(userAgent) .get(); Element table = doc.select("table").get(0); Elements rows = table.select("tr"); -- cgit v1.2.3