fix dashmpd bug

This commit is contained in:
Christian Schabesberger 2017-02-27 17:57:16 +01:00
parent ce2ceb8a1b
commit f5625a1151
1 changed files with 18 additions and 6 deletions

View File

@ -420,9 +420,15 @@ public class YoutubeStreamExtractor extends StreamExtractor {
@Override @Override
public String getDashMpdUrl() throws ParsingException { public String getDashMpdUrl() throws ParsingException {
/*
try { try {
String dashManifestUrl = videoInfoPage.get("dashmpd"); String dashManifestUrl = "";
if(videoInfoPage != null && videoInfoPage.containsKey("dashmpd")) {
dashManifestUrl = videoInfoPage.get("dashmpd");
} else if (playerArgs.has("dashmpd")) {
dashManifestUrl = playerArgs.getString("dashmpd");
} else {
return "";
}
if(!dashManifestUrl.contains("/signature/")) { if(!dashManifestUrl.contains("/signature/")) {
String encryptedSig = Parser.matchGroup1("/s/([a-fA-F0-9\\.]+)", dashManifestUrl); String encryptedSig = Parser.matchGroup1("/s/([a-fA-F0-9\\.]+)", dashManifestUrl);
String decryptedSig; String decryptedSig;
@ -435,8 +441,6 @@ public class YoutubeStreamExtractor extends StreamExtractor {
throw new ParsingException( throw new ParsingException(
"Could not get \"dashmpd\" maybe VideoInfoPage is broken.", e); "Could not get \"dashmpd\" maybe VideoInfoPage is broken.", e);
} }
*/
return "";
} }
@ -447,9 +451,17 @@ public class YoutubeStreamExtractor extends StreamExtractor {
String encodedUrlMap; String encodedUrlMap;
// playerArgs could be null if the video is age restricted // playerArgs could be null if the video is age restricted
if (playerArgs == null) { if (playerArgs == null) {
encodedUrlMap = videoInfoPage.get("adaptive_fmts"); if(videoInfoPage.containsKey("adaptive_fmts")) {
encodedUrlMap = videoInfoPage.get("adaptive_fmts");
} else {
return null;
}
} else { } else {
encodedUrlMap = playerArgs.getString("adaptive_fmts"); if(playerArgs.has("adaptive_fmts")) {
encodedUrlMap = playerArgs.getString("adaptive_fmts");
} else {
return null;
}
} }
for(String url_data_str : encodedUrlMap.split(",")) { for(String url_data_str : encodedUrlMap.split(",")) {
// This loop iterates through multiple streams, therefor tags // This loop iterates through multiple streams, therefor tags