Class Downloader
- java.lang.Object
 - 
- org.schabi.newpipe.extractor.downloader.Downloader
 
 
- 
public abstract class Downloader extends java.lang.ObjectA base for downloader implementations that NewPipe will use to download needed resources during extraction. 
- 
- 
Constructor Summary
Constructors Constructor Description Downloader() 
- 
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract Responseexecute(Request request)Do a request using the specifiedRequestobject.Responseget(java.lang.String url)Do a GET request to get the resource that the url is pointing to.
This method callsget(String, Map, Localization)with the default preferred localization.Responseget(java.lang.String url, java.util.Map<java.lang.String,java.util.List<java.lang.String>> headers)Do a GET request with the specified headers.Responseget(java.lang.String url, java.util.Map<java.lang.String,java.util.List<java.lang.String>> headers, Localization localization)Do a GET request with the specified headers.
It will set theAccept-Languageheader to the language of the localization parameter.Responseget(java.lang.String url, Localization localization)Do a GET request to get the resource that the url is pointing to.
It will set theAccept-Languageheader to the language of the localization parameter.Responsehead(java.lang.String url)Do a HEAD request.Responsehead(java.lang.String url, java.util.Map<java.lang.String,java.util.List<java.lang.String>> headers)Do a HEAD request with the specified headers.Responsepost(java.lang.String url, java.util.Map<java.lang.String,java.util.List<java.lang.String>> headers, byte[] dataToSend)Do a POST request with the specified headers, sending the data array.Responsepost(java.lang.String url, java.util.Map<java.lang.String,java.util.List<java.lang.String>> headers, byte[] dataToSend, Localization localization)Do a POST request with the specified headers, sending the data array.ResponsepostWithContentType(java.lang.String url, java.util.Map<java.lang.String,java.util.List<java.lang.String>> headers, byte[] dataToSend, java.lang.String contentType)Convenient method to send a POST request using the specified value of theContent-Typeheader.ResponsepostWithContentType(java.lang.String url, java.util.Map<java.lang.String,java.util.List<java.lang.String>> headers, byte[] dataToSend, Localization localization, java.lang.String contentType)Convenient method to send a POST request using the specified value of theContent-Typeheader with a givenLocalization.ResponsepostWithContentTypeJson(java.lang.String url, java.util.Map<java.lang.String,java.util.List<java.lang.String>> headers, byte[] dataToSend)Convenient method to send a POST request the JSON mime type as the value of theContent-Typeheader.ResponsepostWithContentTypeJson(java.lang.String url, java.util.Map<java.lang.String,java.util.List<java.lang.String>> headers, byte[] dataToSend, Localization localization)Convenient method to send a POST request the JSON mime type as the value of theContent-Typeheader with a givenLocalization. 
 - 
 
- 
- 
Method Detail
- 
get
public Response get(java.lang.String url) throws java.io.IOException, ReCaptchaException
Do a GET request to get the resource that the url is pointing to.
This method callsget(String, Map, Localization)with the default preferred localization. It should only be used when the resource that will be fetched won't be affected by the localization.- Parameters:
 url- the URL that is pointing to the wanted resource- Returns:
 - the result of the GET request
 - Throws:
 java.io.IOExceptionReCaptchaException
 
- 
get
public Response get(java.lang.String url, Localization localization) throws java.io.IOException, ReCaptchaException
Do a GET request to get the resource that the url is pointing to.
It will set theAccept-Languageheader to the language of the localization parameter.- Parameters:
 url- the URL that is pointing to the wanted resourcelocalization- the source of the value of theAccept-Languageheader- Returns:
 - the result of the GET request
 - Throws:
 java.io.IOExceptionReCaptchaException
 
- 
get
public Response get(java.lang.String url, @Nullable java.util.Map<java.lang.String,java.util.List<java.lang.String>> headers) throws java.io.IOException, ReCaptchaException
Do a GET request with the specified headers.- Parameters:
 url- the URL that is pointing to the wanted resourceheaders- a list of headers that will be used in the request. Any default headers should be overridden by these.- Returns:
 - the result of the GET request
 - Throws:
 java.io.IOExceptionReCaptchaException
 
- 
get
public Response get(java.lang.String url, @Nullable java.util.Map<java.lang.String,java.util.List<java.lang.String>> headers, Localization localization) throws java.io.IOException, ReCaptchaException
Do a GET request with the specified headers.
It will set theAccept-Languageheader to the language of the localization parameter.- Parameters:
 url- the URL that is pointing to the wanted resourceheaders- a list of headers that will be used in the request. Any default headers should be overridden by these.localization- the source of the value of theAccept-Languageheader- Returns:
 - the result of the GET request
 - Throws:
 java.io.IOExceptionReCaptchaException
 
- 
head
public Response head(java.lang.String url) throws java.io.IOException, ReCaptchaException
Do a HEAD request.- Parameters:
 url- the URL that is pointing to the wanted resource- Returns:
 - the result of the HEAD request
 - Throws:
 java.io.IOExceptionReCaptchaException
 
- 
head
public Response head(java.lang.String url, @Nullable java.util.Map<java.lang.String,java.util.List<java.lang.String>> headers) throws java.io.IOException, ReCaptchaException
Do a HEAD request with the specified headers.- Parameters:
 url- the URL that is pointing to the wanted resourceheaders- a list of headers that will be used in the request. Any default headers should be overridden by these.- Returns:
 - the result of the HEAD request
 - Throws:
 java.io.IOExceptionReCaptchaException
 
- 
post
public Response post(java.lang.String url, @Nullable java.util.Map<java.lang.String,java.util.List<java.lang.String>> headers, @Nullable byte[] dataToSend) throws java.io.IOException, ReCaptchaException
Do a POST request with the specified headers, sending the data array.- Parameters:
 url- the URL that is pointing to the wanted resourceheaders- a list of headers that will be used in the request. Any default headers should be overridden by these.dataToSend- byte array that will be sent when doing the request.- Returns:
 - the result of the POST request
 - Throws:
 java.io.IOExceptionReCaptchaException
 
- 
post
public Response post(java.lang.String url, @Nullable java.util.Map<java.lang.String,java.util.List<java.lang.String>> headers, @Nullable byte[] dataToSend, Localization localization) throws java.io.IOException, ReCaptchaException
Do a POST request with the specified headers, sending the data array.
It will set theAccept-Languageheader to the language of the localization parameter.- Parameters:
 url- the URL that is pointing to the wanted resourceheaders- a list of headers that will be used in the request. Any default headers should be overridden by these.dataToSend- byte array that will be sent when doing the request.localization- the source of the value of theAccept-Languageheader- Returns:
 - the result of the POST request
 - Throws:
 java.io.IOExceptionReCaptchaException
 
- 
postWithContentType
public Response postWithContentType(java.lang.String url, @Nullable java.util.Map<java.lang.String,java.util.List<java.lang.String>> headers, @Nullable byte[] dataToSend, Localization localization, java.lang.String contentType) throws java.io.IOException, ReCaptchaException
Convenient method to send a POST request using the specified value of theContent-Typeheader with a givenLocalization.- Parameters:
 url- the URL that is pointing to the wanted resourceheaders- a list of headers that will be used in the request. Any default headers should be overridden by these.dataToSend- byte array that will be sent when doing the request.localization- the source of the value of theAccept-LanguageheadercontentType- the mime type of the body sent, which will be set as the value of theContent-Typeheader- Returns:
 - the result of the POST request
 - Throws:
 java.io.IOExceptionReCaptchaException- See Also:
 post(String, Map, byte[], Localization)
 
- 
postWithContentType
public Response postWithContentType(java.lang.String url, @Nullable java.util.Map<java.lang.String,java.util.List<java.lang.String>> headers, @Nullable byte[] dataToSend, java.lang.String contentType) throws java.io.IOException, ReCaptchaException
Convenient method to send a POST request using the specified value of theContent-Typeheader.- Parameters:
 url- the URL that is pointing to the wanted resourceheaders- a list of headers that will be used in the request. Any default headers should be overridden by these.dataToSend- byte array that will be sent when doing the request.contentType- the mime type of the body sent, which will be set as the value of theContent-Typeheader- Returns:
 - the result of the POST request
 - Throws:
 java.io.IOExceptionReCaptchaException- See Also:
 post(String, Map, byte[], Localization)
 
- 
postWithContentTypeJson
public Response postWithContentTypeJson(java.lang.String url, @Nullable java.util.Map<java.lang.String,java.util.List<java.lang.String>> headers, @Nullable byte[] dataToSend, Localization localization) throws java.io.IOException, ReCaptchaException
Convenient method to send a POST request the JSON mime type as the value of theContent-Typeheader with a givenLocalization.- Parameters:
 url- the URL that is pointing to the wanted resourceheaders- a list of headers that will be used in the request. Any default headers should be overridden by these.dataToSend- byte array that will be sent when doing the request.localization- the source of the value of theAccept-Languageheader- Returns:
 - the result of the POST request
 - Throws:
 java.io.IOExceptionReCaptchaException- See Also:
 post(String, Map, byte[], Localization)
 
- 
postWithContentTypeJson
public Response postWithContentTypeJson(java.lang.String url, @Nullable java.util.Map<java.lang.String,java.util.List<java.lang.String>> headers, @Nullable byte[] dataToSend) throws java.io.IOException, ReCaptchaException
Convenient method to send a POST request the JSON mime type as the value of theContent-Typeheader.- Parameters:
 url- the URL that is pointing to the wanted resourceheaders- a list of headers that will be used in the request. Any default headers should be overridden by these.dataToSend- byte array that will be sent when doing the request.- Returns:
 - the result of the POST request
 - Throws:
 java.io.IOExceptionReCaptchaException- See Also:
 post(String, Map, byte[], Localization)
 
- 
execute
public abstract Response execute(@Nonnull Request request) throws java.io.IOException, ReCaptchaException
Do a request using the specifiedRequestobject.- Returns:
 - the result of the request
 - Throws:
 java.io.IOExceptionReCaptchaException
 
 - 
 
 -