some fixes

This commit is contained in:
Thomas 2020-05-23 12:45:31 +02:00
parent d317f036d1
commit 962fdaa09b
1 changed files with 6 additions and 5 deletions

View File

@ -97,7 +97,10 @@ public class Utils {
private static final String[] G_TRACKING = {
"sourceid",
"aqs",
"client"
"client",
"source",
"ust",
"usg"
};
private static final String[] UTM_PARAMS = {
@ -245,9 +248,8 @@ public class Utils {
}
}
if (newUrl != null && (newUrl.endsWith("tweets") || newUrl.endsWith("tweets/"))) {
newUrl = newUrl.replace("/tweets/", "").replace("/tweets", "");
newUrl = newUrl.replaceAll("/tweets/?", "");
}
return newUrl;
} else {
return url;
@ -369,7 +371,6 @@ public class Utils {
* @return cleaned URL String
*/
public static String remove_tracking_param(String url) {
if (url != null) {
for (String utm : UTM_PARAMS) {
url = url.replaceAll("&" + utm + "=[0-9a-zA-Z._-]*", "");
@ -385,7 +386,7 @@ public class Utils {
}
URL redirectURL = new URL(url);
String host = redirectURL.getHost();
if (host != null && host.contains("google")) {
if (host != null) {
for (String utm : G_TRACKING) {
assert url != null;
url = url.replaceAll("&" + utm + "=[0-9a-zA-Z._-]*", "");