Fix issue #10
This commit is contained in:
parent
4e66b69f57
commit
65167f643f
|
@ -475,18 +475,20 @@ public class TransformActivity extends Activity {
|
|||
if (nitter_enabled) {
|
||||
String nitterHost = sharedpreferences.getString(MainActivity.SET_NITTER_HOST, MainActivity.DEFAULT_NITTER_HOST).toLowerCase();
|
||||
assert host != null;
|
||||
if (host.compareTo("pbs.twimg.com") != 0 || host.compareTo("pic.twitter.com") != 0) {
|
||||
Matcher matcher = nitterPattern.matcher(url);
|
||||
while (matcher.find()) {
|
||||
final String nitter_directory = matcher.group(2);
|
||||
newUrl = "https://" + nitterHost + nitter_directory;
|
||||
}
|
||||
} else {
|
||||
if (host.compareTo("pbs.twimg.com") == 0 || host.compareTo("pic.twitter.com") == 0) {
|
||||
try {
|
||||
newUrl = "https://" + nitterHost + "/pic/" + URLEncoder.encode(url, "utf-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
newUrl = "https://" + nitterHost + "/pic/" + url;
|
||||
}
|
||||
}else if(url.contains("/search?")){
|
||||
newUrl = url.replace(host, nitterHost);
|
||||
} else {
|
||||
Matcher matcher = nitterPattern.matcher(url);
|
||||
while (matcher.find()) {
|
||||
final String nitter_directory = matcher.group(2);
|
||||
newUrl = "https://" + nitterHost + nitter_directory;
|
||||
}
|
||||
}
|
||||
return newUrl;
|
||||
} else {
|
||||
|
@ -621,18 +623,20 @@ public class TransformActivity extends Activity {
|
|||
|
||||
String nitterHost = sharedpreferences.getString(MainActivity.SET_NITTER_HOST, MainActivity.DEFAULT_NITTER_HOST).toLowerCase();
|
||||
assert host != null;
|
||||
if (host.compareTo("pbs.twimg.com") != 0 || host.compareTo("pic.twitter.com") != 0) {
|
||||
Matcher matcher = nitterPattern.matcher(url);
|
||||
while (matcher.find()) {
|
||||
final String nitter_directory = matcher.group(2);
|
||||
newUrl = "https://" + nitterHost + nitter_directory;
|
||||
}
|
||||
} else {
|
||||
if (host.compareTo("pbs.twimg.com") == 0 || host.compareTo("pic.twitter.com") == 0) {
|
||||
try {
|
||||
newUrl = "https://" + nitterHost + "/pic/" + URLEncoder.encode(url, "utf-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
newUrl = "https://" + nitterHost + "/pic/" + url;
|
||||
}
|
||||
}else if(url.contains("/search?")){
|
||||
newUrl = url.replace(host, nitterHost);
|
||||
} else {
|
||||
Matcher matcher = nitterPattern.matcher(url);
|
||||
while (matcher.find()) {
|
||||
final String nitter_directory = matcher.group(2);
|
||||
newUrl = "https://" + nitterHost + nitter_directory;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (Arrays.asList(instagram_domains).contains(host)) {
|
||||
|
|
Loading…
Reference in New Issue