mirror of
https://github.com/TeamNewPipe/NewPipeExtractor.git
synced 2025-04-28 16:00:33 +05:30
Reduce bandwidth consume by StreamExtractor
- Don't download the not needed info page - The difference is very small (~20-30 KB)
This commit is contained in:
parent
f308755359
commit
390e5727d6
@ -175,7 +175,7 @@ public class YoutubeStreamExtractor extends StreamExtractor {
|
|||||||
@Override
|
@Override
|
||||||
public long getLength() throws ParsingException {
|
public long getLength() throws ParsingException {
|
||||||
try {
|
try {
|
||||||
long returnValue = playerArgs.getNumber("length_seconds", -1).longValue();
|
long returnValue = Long.parseLong(playerArgs.get("length_seconds") + "");
|
||||||
if (returnValue >= 0) return returnValue;
|
if (returnValue >= 0) return returnValue;
|
||||||
} catch (Exception ignored) {
|
} catch (Exception ignored) {
|
||||||
// Try other method...
|
// Try other method...
|
||||||
@ -504,14 +504,12 @@ public class YoutubeStreamExtractor extends StreamExtractor {
|
|||||||
|
|
||||||
String pageContent = dl.download(getCleanUrl());
|
String pageContent = dl.download(getCleanUrl());
|
||||||
doc = Jsoup.parse(pageContent, getCleanUrl());
|
doc = Jsoup.parse(pageContent, getCleanUrl());
|
||||||
String infoPageResponse = dl.download(String.format(GET_VIDEO_INFO_URL, getId()));
|
|
||||||
videoInfoPage = Parser.compatParseMap(infoPageResponse);
|
|
||||||
|
|
||||||
|
|
||||||
String playerUrl;
|
String playerUrl;
|
||||||
|
|
||||||
// Check if the video is age restricted
|
// Check if the video is age restricted
|
||||||
if (pageContent.contains("<meta property=\"og:restrictions:age")) {
|
if (pageContent.contains("<meta property=\"og:restrictions:age")) {
|
||||||
|
String infoPageResponse = dl.download(String.format(GET_VIDEO_INFO_URL, getId()));
|
||||||
|
videoInfoPage = Parser.compatParseMap(infoPageResponse);
|
||||||
playerUrl = getPlayerUrlFromRestrictedVideo();
|
playerUrl = getPlayerUrlFromRestrictedVideo();
|
||||||
isAgeRestricted = true;
|
isAgeRestricted = true;
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user