fixed useragent issue in RoomData
This commit is contained in:
parent
235d33e9f4
commit
e700953ebb
3 changed files with 12 additions and 8 deletions
|
@ -11,8 +11,8 @@ android {
|
||||||
applicationId "me.brysonsteck.wiimmfiwatcher"
|
applicationId "me.brysonsteck.wiimmfiwatcher"
|
||||||
minSdkVersion 19
|
minSdkVersion 19
|
||||||
targetSdkVersion 30
|
targetSdkVersion 30
|
||||||
versionCode 2
|
versionCode 3
|
||||||
versionName "1.1"
|
versionName "1.1.1"
|
||||||
|
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,11 +8,14 @@ import org.jsoup.select.Elements;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import me.brysonsteck.wiimmfiwatcher.BuildConfig;
|
||||||
|
|
||||||
public class RoomData {
|
public class RoomData {
|
||||||
String roomHeader;
|
String roomHeader;
|
||||||
String playerLink;
|
String playerLink;
|
||||||
String friendCode;
|
String friendCode;
|
||||||
ArrayList<Player> players = new ArrayList<>();
|
ArrayList<Player> players = new ArrayList<>();
|
||||||
|
String userAgent = "Wiimmfi Watcher for Android (https://github.com/brysonsteck/wiimmfi-watcher) Version " + BuildConfig.VERSION_NAME;
|
||||||
|
|
||||||
public RoomData (ArrayList<Player> players, String friendCode) {
|
public RoomData (ArrayList<Player> players, String friendCode) {
|
||||||
this.friendCode = friendCode;
|
this.friendCode = friendCode;
|
||||||
|
@ -24,8 +27,9 @@ public class RoomData {
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
System.out.println(userAgent);
|
||||||
doc = Jsoup.connect("https://wiimmfi.de/" + this.playerLink)
|
doc = Jsoup.connect("https://wiimmfi.de/" + this.playerLink)
|
||||||
.userAgent("Wiimmfi Watcher for Android (https://github.com/brysonsteck/wiimmfi-watcher) (UNDER DEVELOPMENT)")
|
.userAgent(userAgent)
|
||||||
.get();
|
.get();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -92,7 +96,7 @@ public class RoomData {
|
||||||
public void getPlayerLink() {
|
public void getPlayerLink() {
|
||||||
try {
|
try {
|
||||||
Document doc = Jsoup.connect("https://wiimmfi.de/stats/mkw")
|
Document doc = Jsoup.connect("https://wiimmfi.de/stats/mkw")
|
||||||
.userAgent("Wiimmfi Watcher for Android (https://github.com/brysonsteck/wiimmfi-watcher)")
|
.userAgent(userAgent)
|
||||||
.get();
|
.get();
|
||||||
Element table = doc.select("table").get(0);
|
Element table = doc.select("table").get(0);
|
||||||
Elements rows = table.select("tr");
|
Elements rows = table.select("tr");
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
<resources>
|
<resources>
|
||||||
<string name="app_name">Wiimmfi</string>
|
<string name="app_name">Wiimmfi</string>
|
||||||
<string name="github">All of the code in this project is open source on my GitHub repository <a href='https://github.com/brysonsteck/wiimmfi-watcher/tree/master'>here.</a> You are free to use this code and expand upon it under the GNU General Public License.</string>
|
<string name="github">All of the code in this project is open source on my GitHub repository <a href='https://github.com/brysonsteck/wiimmfi-watcher/tree/master'>here.</a> You are free to use this code and expand upon it under the <a href='https://github.com/brysonsteck/wiimmfi-watcher/tree/master/LICENSE'>GNU General Public License</a> (Version 3).</string>
|
||||||
<string name="bugs">Speaking of bugs, did you find a bug? First, make sure that the issue you found is not listed on my <a href='https://github.com/brysonsteck/wiimmfi-watcher/blob/master/TODO.md'>todo list.</a> It\'s possible I\'m already aware of it or working on it. If your issue is not addressed on the todo list, then you can create an issue on my GitHub repository <a href='https://github.com/brysonsteck/wiimmfi-watcher/issues'>here.</a> If you don\'t know how to use GitHub, you can fill out this <a href='https://docs.google.com/forms/d/e/1FAIpQLSd6qCONAP2tsbHPgzu_CdZcHVHL5nx7q0XFqrVfExEc84kqUQ/viewform?usp=sf_link'>Google Form</a> instead.</string>
|
<string name="bugs">Speaking of bugs, did you find a bug? Do you want to provide feedback on the app? I\'d love to hear it! First, make sure that the issue you found is not listed on my <a href='https://github.com/brysonsteck/wiimmfi-watcher/blob/master/TODO.md'>todo list.</a> It\'s possible I\'m already aware of it or working on it. If your issue is not addressed on the todo list, then you can create an issue on my GitHub repository <a href='https://github.com/brysonsteck/wiimmfi-watcher/issues'>here.</a> If you don\'t know how to use GitHub, you can fill out this <a href='https://docs.google.com/forms/d/e/1FAIpQLSd6qCONAP2tsbHPgzu_CdZcHVHL5nx7q0XFqrVfExEc84kqUQ/viewform?usp=sf_link'>Google Form</a> instead.</string>
|
||||||
<string name="license">© Copyright 2021 Bryson Steck\n\nWiimmfi Watcher is available under the GNU General Public License Version 3. You can view the license <a href='https://github.com/brysonsteck/wiimmfi-watcher/tree/dev/LICENSE'>here.</a>\n\nWiimmfi Watcher is free software: you can redistribute it and/or modify
|
<string name="license">© Copyright 2021 Bryson Steck\n\nWiimmfi Watcher is available under the GNU General Public License Version 3. You can view the license <a href='https://github.com/brysonsteck/wiimmfi-watcher/tree/master/LICENSE'>here.</a>\n\nWiimmfi Watcher is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
(at your option) any later version.\n\nWiimmfi Watcher is distributed in the hope that it will be useful,
|
(at your option) any later version.\n\nWiimmfi Watcher is distributed in the hope that it will be useful,
|
||||||
|
|
Reference in a new issue