rename reCaptchaException to ReCaptchaException
This commit is contained in:
parent
cd65f1dffc
commit
937a387f4e
|
@ -1,6 +1,6 @@
|
||||||
package org.schabi.newpipe;
|
package org.schabi.newpipe;
|
||||||
|
|
||||||
import org.schabi.newpipe.extractor.exceptions.reCaptchaException;
|
import org.schabi.newpipe.extractor.exceptions.ReCaptchaException;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -67,7 +67,7 @@ public class Downloader implements org.schabi.newpipe.extractor.Downloader {
|
||||||
* @param siteUrl the URL of the text file to return the contents of
|
* @param siteUrl the URL of the text file to return the contents of
|
||||||
* @param language the language (usually a 2-character code) to set as the preferred language
|
* @param language the language (usually a 2-character code) to set as the preferred language
|
||||||
* @return the contents of the specified text file*/
|
* @return the contents of the specified text file*/
|
||||||
public String download(String siteUrl, String language) throws IOException, reCaptchaException {
|
public String download(String siteUrl, String language) throws IOException, ReCaptchaException {
|
||||||
Map<String, String> requestProperties = new HashMap<>();
|
Map<String, String> requestProperties = new HashMap<>();
|
||||||
requestProperties.put("Accept-Language", language);
|
requestProperties.put("Accept-Language", language);
|
||||||
return download(siteUrl, requestProperties);
|
return download(siteUrl, requestProperties);
|
||||||
|
@ -80,7 +80,7 @@ public class Downloader implements org.schabi.newpipe.extractor.Downloader {
|
||||||
* @param customProperties set request header properties
|
* @param customProperties set request header properties
|
||||||
* @return the contents of the specified text file
|
* @return the contents of the specified text file
|
||||||
* @throws IOException*/
|
* @throws IOException*/
|
||||||
public String download(String siteUrl, Map<String, String> customProperties) throws IOException, reCaptchaException {
|
public String download(String siteUrl, Map<String, String> customProperties) throws IOException, ReCaptchaException {
|
||||||
URL url = new URL(siteUrl);
|
URL url = new URL(siteUrl);
|
||||||
HttpsURLConnection con = (HttpsURLConnection) url.openConnection();
|
HttpsURLConnection con = (HttpsURLConnection) url.openConnection();
|
||||||
Iterator it = customProperties.entrySet().iterator();
|
Iterator it = customProperties.entrySet().iterator();
|
||||||
|
@ -92,7 +92,7 @@ public class Downloader implements org.schabi.newpipe.extractor.Downloader {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**Common functionality between download(String url) and download(String url, String language)*/
|
/**Common functionality between download(String url) and download(String url, String language)*/
|
||||||
private static String dl(HttpsURLConnection con) throws IOException, reCaptchaException {
|
private static String dl(HttpsURLConnection con) throws IOException, ReCaptchaException {
|
||||||
StringBuilder response = new StringBuilder();
|
StringBuilder response = new StringBuilder();
|
||||||
BufferedReader in = null;
|
BufferedReader in = null;
|
||||||
|
|
||||||
|
@ -121,7 +121,7 @@ public class Downloader implements org.schabi.newpipe.extractor.Downloader {
|
||||||
* See : https://github.com/rg3/youtube-dl/issues/5138
|
* See : https://github.com/rg3/youtube-dl/issues/5138
|
||||||
*/
|
*/
|
||||||
if (con.getResponseCode() == 429) {
|
if (con.getResponseCode() == 429) {
|
||||||
throw new reCaptchaException("reCaptcha Challenge requested");
|
throw new ReCaptchaException("reCaptcha Challenge requested");
|
||||||
}
|
}
|
||||||
throw new IOException(e);
|
throw new IOException(e);
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -137,7 +137,7 @@ public class Downloader implements org.schabi.newpipe.extractor.Downloader {
|
||||||
* Primarily intended for downloading web pages.
|
* Primarily intended for downloading web pages.
|
||||||
* @param siteUrl the URL of the text file to download
|
* @param siteUrl the URL of the text file to download
|
||||||
* @return the contents of the specified text file*/
|
* @return the contents of the specified text file*/
|
||||||
public String download(String siteUrl) throws IOException, reCaptchaException {
|
public String download(String siteUrl) throws IOException, ReCaptchaException {
|
||||||
URL url = new URL(siteUrl);
|
URL url = new URL(siteUrl);
|
||||||
HttpsURLConnection con = (HttpsURLConnection) url.openConnection();
|
HttpsURLConnection con = (HttpsURLConnection) url.openConnection();
|
||||||
//HttpsURLConnection con = NetCipher.getHttpsURLConnection(url);
|
//HttpsURLConnection con = NetCipher.getHttpsURLConnection(url);
|
||||||
|
|
|
@ -3,7 +3,7 @@ package org.schabi.newpipe.extractor;
|
||||||
import android.util.Xml;
|
import android.util.Xml;
|
||||||
|
|
||||||
import org.schabi.newpipe.extractor.exceptions.ParsingException;
|
import org.schabi.newpipe.extractor.exceptions.ParsingException;
|
||||||
import org.schabi.newpipe.extractor.exceptions.reCaptchaException;
|
import org.schabi.newpipe.extractor.exceptions.ReCaptchaException;
|
||||||
import org.schabi.newpipe.extractor.stream_info.AudioStream;
|
import org.schabi.newpipe.extractor.stream_info.AudioStream;
|
||||||
import org.xmlpull.v1.XmlPullParser;
|
import org.xmlpull.v1.XmlPullParser;
|
||||||
|
|
||||||
|
@ -44,15 +44,15 @@ public class DashMpdParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<AudioStream> getAudioStreams(String dashManifestUrl)
|
public static List<AudioStream> getAudioStreams(String dashManifestUrl)
|
||||||
throws DashMpdParsingException, reCaptchaException {
|
throws DashMpdParsingException, ReCaptchaException {
|
||||||
String dashDoc;
|
String dashDoc;
|
||||||
Downloader downloader = NewPipe.getDownloader();
|
Downloader downloader = NewPipe.getDownloader();
|
||||||
try {
|
try {
|
||||||
dashDoc = downloader.download(dashManifestUrl);
|
dashDoc = downloader.download(dashManifestUrl);
|
||||||
} catch(IOException ioe) {
|
} catch(IOException ioe) {
|
||||||
throw new DashMpdParsingException("Could not get dash mpd: " + dashManifestUrl, ioe);
|
throw new DashMpdParsingException("Could not get dash mpd: " + dashManifestUrl, ioe);
|
||||||
} catch (reCaptchaException e) {
|
} catch (ReCaptchaException e) {
|
||||||
throw new reCaptchaException("reCaptcha Challenge needed");
|
throw new ReCaptchaException("reCaptcha Challenge needed");
|
||||||
}
|
}
|
||||||
Vector<AudioStream> audioStreams = new Vector<>();
|
Vector<AudioStream> audioStreams = new Vector<>();
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package org.schabi.newpipe.extractor;
|
package org.schabi.newpipe.extractor;
|
||||||
|
|
||||||
import org.schabi.newpipe.extractor.exceptions.reCaptchaException;
|
import org.schabi.newpipe.extractor.exceptions.ReCaptchaException;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -33,7 +33,7 @@ public interface Downloader {
|
||||||
* @param language the language (usually a 2-character code) to set as the preferred language
|
* @param language the language (usually a 2-character code) to set as the preferred language
|
||||||
* @return the contents of the specified text file
|
* @return the contents of the specified text file
|
||||||
* @throws IOException*/
|
* @throws IOException*/
|
||||||
String download(String siteUrl, String language) throws IOException, reCaptchaException;
|
String download(String siteUrl, String language) throws IOException, ReCaptchaException;
|
||||||
|
|
||||||
/**Download the text file at the supplied URL as in download(String),
|
/**Download the text file at the supplied URL as in download(String),
|
||||||
* but set the HTTP header field "Accept-Language" to the supplied string.
|
* but set the HTTP header field "Accept-Language" to the supplied string.
|
||||||
|
@ -41,12 +41,12 @@ public interface Downloader {
|
||||||
* @param customProperties set request header properties
|
* @param customProperties set request header properties
|
||||||
* @return the contents of the specified text file
|
* @return the contents of the specified text file
|
||||||
* @throws IOException*/
|
* @throws IOException*/
|
||||||
String download(String siteUrl, Map<String, String> customProperties) throws IOException, reCaptchaException;
|
String download(String siteUrl, Map<String, String> customProperties) throws IOException, ReCaptchaException;
|
||||||
|
|
||||||
/**Download (via HTTP) the text file located at the supplied URL, and return its contents.
|
/**Download (via HTTP) the text file located at the supplied URL, and return its contents.
|
||||||
* Primarily intended for downloading web pages.
|
* Primarily intended for downloading web pages.
|
||||||
* @param siteUrl the URL of the text file to download
|
* @param siteUrl the URL of the text file to download
|
||||||
* @return the contents of the specified text file
|
* @return the contents of the specified text file
|
||||||
* @throws IOException*/
|
* @throws IOException*/
|
||||||
String download(String siteUrl) throws IOException, reCaptchaException;
|
String download(String siteUrl) throws IOException, ReCaptchaException;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ package org.schabi.newpipe.extractor.exceptions;
|
||||||
* Created by beneth <bmauduit@beneth.fr> on 07.12.16.
|
* Created by beneth <bmauduit@beneth.fr> on 07.12.16.
|
||||||
*
|
*
|
||||||
* Copyright (C) Christian Schabesberger 2016 <chris.schabesberger@mailbox.org>
|
* Copyright (C) Christian Schabesberger 2016 <chris.schabesberger@mailbox.org>
|
||||||
* reCaptchaException.java is part of NewPipe.
|
* ReCaptchaException.java is part of NewPipe.
|
||||||
*
|
*
|
||||||
* NewPipe is free software: you can redistribute it and/or modify
|
* NewPipe 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
|
||||||
|
@ -20,8 +20,8 @@ package org.schabi.newpipe.extractor.exceptions;
|
||||||
* along with NewPipe. If not, see <http://www.gnu.org/licenses/>.
|
* along with NewPipe. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class reCaptchaException extends ExtractionException {
|
public class ReCaptchaException extends ExtractionException {
|
||||||
public reCaptchaException(String message) {
|
public ReCaptchaException(String message) {
|
||||||
super(message);
|
super(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -11,7 +11,7 @@ import org.mozilla.javascript.ScriptableObject;
|
||||||
import org.schabi.newpipe.extractor.AbstractStreamInfo;
|
import org.schabi.newpipe.extractor.AbstractStreamInfo;
|
||||||
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
|
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
|
||||||
import org.schabi.newpipe.extractor.exceptions.ParsingException;
|
import org.schabi.newpipe.extractor.exceptions.ParsingException;
|
||||||
import org.schabi.newpipe.extractor.exceptions.reCaptchaException;
|
import org.schabi.newpipe.extractor.exceptions.ReCaptchaException;
|
||||||
import org.schabi.newpipe.extractor.stream_info.AudioStream;
|
import org.schabi.newpipe.extractor.stream_info.AudioStream;
|
||||||
import org.schabi.newpipe.extractor.Downloader;
|
import org.schabi.newpipe.extractor.Downloader;
|
||||||
import org.schabi.newpipe.extractor.NewPipe;
|
import org.schabi.newpipe.extractor.NewPipe;
|
||||||
|
@ -281,7 +281,7 @@ public class YoutubeStreamExtractor extends StreamExtractor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getPlayerUrlFromRestrictedVideo(String pageUrl) throws ParsingException, reCaptchaException {
|
private String getPlayerUrlFromRestrictedVideo(String pageUrl) throws ParsingException, ReCaptchaException {
|
||||||
try {
|
try {
|
||||||
Downloader downloader = NewPipe.getDownloader();
|
Downloader downloader = NewPipe.getDownloader();
|
||||||
String playerUrl = "";
|
String playerUrl = "";
|
||||||
|
@ -303,8 +303,8 @@ public class YoutubeStreamExtractor extends StreamExtractor {
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new ParsingException(
|
throw new ParsingException(
|
||||||
"Could load decryption code form restricted video for the Youtube service.", e);
|
"Could load decryption code form restricted video for the Youtube service.", e);
|
||||||
} catch (reCaptchaException e) {
|
} catch (ReCaptchaException e) {
|
||||||
throw new reCaptchaException("reCaptcha Challenge requested");
|
throw new ReCaptchaException("reCaptcha Challenge requested");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
|
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
|
||||||
import org.schabi.newpipe.extractor.exceptions.reCaptchaException;
|
import org.schabi.newpipe.extractor.exceptions.ReCaptchaException;
|
||||||
import org.schabi.newpipe.extractor.search.SearchEngine;
|
import org.schabi.newpipe.extractor.search.SearchEngine;
|
||||||
import org.schabi.newpipe.extractor.search.SearchResult;
|
import org.schabi.newpipe.extractor.search.SearchResult;
|
||||||
import org.schabi.newpipe.report.ErrorActivity;
|
import org.schabi.newpipe.report.ErrorActivity;
|
||||||
|
@ -123,7 +123,7 @@ public class SearchWorker {
|
||||||
|
|
||||||
}
|
}
|
||||||
// hard errors:
|
// hard errors:
|
||||||
} catch (reCaptchaException e) {
|
} catch (ReCaptchaException e) {
|
||||||
h.post(new Runnable() {
|
h.post(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|
Loading…
Reference in New Issue