mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2024-12-23 16:40:32 +00:00
Update extractor version and add head request to downloader
This commit is contained in:
parent
4f688862a2
commit
c4eaee1e31
@ -57,7 +57,7 @@ dependencies {
|
|||||||
exclude module: 'support-annotations'
|
exclude module: 'support-annotations'
|
||||||
})
|
})
|
||||||
|
|
||||||
implementation 'com.github.teamnewpipe:NewPipeExtractor:06f2144e4daa10'
|
implementation 'com.github.teamnewpipe:NewPipeExtractor:v0.17.4'
|
||||||
testImplementation 'junit:junit:4.12'
|
testImplementation 'junit:junit:4.12'
|
||||||
testImplementation 'org.mockito:mockito-core:2.23.0'
|
testImplementation 'org.mockito:mockito-core:2.23.0'
|
||||||
|
|
||||||
|
@ -221,7 +221,7 @@ public class Downloader implements org.schabi.newpipe.extractor.Downloader {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new DownloadResponse(body.string(), response.headers().toMultimap());
|
return new DownloadResponse(response.code(), body.string(), response.headers().toMultimap());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -275,6 +275,22 @@ public class Downloader implements org.schabi.newpipe.extractor.Downloader {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new DownloadResponse(body.string(), response.headers().toMultimap());
|
return new DownloadResponse(response.code(), body.string(), response.headers().toMultimap());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DownloadResponse head(String siteUrl) throws IOException, ReCaptchaException {
|
||||||
|
final Request request = new Request.Builder()
|
||||||
|
.head().url(siteUrl)
|
||||||
|
.addHeader("User-Agent", USER_AGENT)
|
||||||
|
.build();
|
||||||
|
final Response response = client.newCall(request).execute();
|
||||||
|
|
||||||
|
if (response.code() == 429) {
|
||||||
|
throw new ReCaptchaException("reCaptcha Challenge requested", siteUrl);
|
||||||
|
}
|
||||||
|
|
||||||
|
return new DownloadResponse(response.code(), null, response.headers().toMultimap());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user