From 7988fe0c5a34afd11aa5a3bd0d4027566f69883f Mon Sep 17 00:00:00 2001 From: Isira Seneviratne Date: Sat, 13 Aug 2022 09:51:55 +0530 Subject: [PATCH] Use new NewPipe Extractor Utils methods. --- app/build.gradle | 2 +- .../java/org/schabi/newpipe/error/ReCaptchaActivity.java | 6 +++--- .../schabi/newpipe/settings/DownloadSettingsFragment.java | 5 ++--- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 806a2bea5..fc074472b 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -187,7 +187,7 @@ dependencies { // name and the commit hash with the commit hash of the (pushed) commit you want to test // This works thanks to JitPack: https://jitpack.io/ implementation 'com.github.TeamNewPipe:nanojson:1d9e1aea9049fc9f85e68b43ba39fe7be1c1f751' - implementation 'com.github.TeamNewPipe:NewPipeExtractor:eb07d70a2ce03bee3cc74fc33b2e4173e1c21436' + implementation 'com.github.TeamNewPipe:NewPipeExtractor:2211a24b6934a8a8cdf5547ea1b52daa4cb5de6c' implementation 'com.github.TeamNewPipe:NoNonsense-FilePicker:5.0.0' /** Checkstyle **/ diff --git a/app/src/main/java/org/schabi/newpipe/error/ReCaptchaActivity.java b/app/src/main/java/org/schabi/newpipe/error/ReCaptchaActivity.java index e2780d215..3c14cfe4c 100644 --- a/app/src/main/java/org/schabi/newpipe/error/ReCaptchaActivity.java +++ b/app/src/main/java/org/schabi/newpipe/error/ReCaptchaActivity.java @@ -20,14 +20,14 @@ import androidx.appcompat.app.AppCompatActivity; import androidx.core.app.NavUtils; import androidx.preference.PreferenceManager; -import org.schabi.newpipe.databinding.ActivityRecaptchaBinding; import org.schabi.newpipe.DownloaderImpl; import org.schabi.newpipe.MainActivity; import org.schabi.newpipe.R; +import org.schabi.newpipe.databinding.ActivityRecaptchaBinding; +import org.schabi.newpipe.extractor.utils.Utils; import org.schabi.newpipe.util.ThemeHelper; import java.io.UnsupportedEncodingException; -import java.net.URLDecoder; /* * Created by beneth on 06.12.16. @@ -188,7 +188,7 @@ public class ReCaptchaActivity extends AppCompatActivity { try { String abuseCookie = url.substring(abuseStart + 13, abuseEnd); - abuseCookie = URLDecoder.decode(abuseCookie, "UTF-8"); + abuseCookie = Utils.decodeUrlUtf8(abuseCookie); handleCookies(abuseCookie); } catch (UnsupportedEncodingException | StringIndexOutOfBoundsException e) { if (MainActivity.DEBUG) { diff --git a/app/src/main/java/org/schabi/newpipe/settings/DownloadSettingsFragment.java b/app/src/main/java/org/schabi/newpipe/settings/DownloadSettingsFragment.java index 5a4300cdd..782b7b906 100644 --- a/app/src/main/java/org/schabi/newpipe/settings/DownloadSettingsFragment.java +++ b/app/src/main/java/org/schabi/newpipe/settings/DownloadSettingsFragment.java @@ -1,5 +1,6 @@ package org.schabi.newpipe.settings; +import static org.schabi.newpipe.extractor.utils.Utils.decodeUrlUtf8; import static org.schabi.newpipe.util.Localization.assureCorrectAppLanguage; import android.app.Activity; @@ -31,8 +32,6 @@ import java.io.File; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.net.URI; -import java.net.URLDecoder; -import java.nio.charset.StandardCharsets; public class DownloadSettingsFragment extends BasePreferenceFragment { public static final boolean IGNORE_RELEASE_ON_OLD_PATH = true; @@ -125,7 +124,7 @@ public class DownloadSettingsFragment extends BasePreferenceFragment { } try { - rawUri = URLDecoder.decode(rawUri, StandardCharsets.UTF_8.name()); + rawUri = decodeUrlUtf8(rawUri); } catch (final UnsupportedEncodingException e) { // nothing to do }