Readd signature decryption in YtStreamExtractor

This commit is contained in:
Stypox 2019-09-11 19:56:16 +02:00
parent d9570d8634
commit e5e8c66686
No known key found for this signature in database
GPG Key ID: 4BDF1B40A49FDD23
1 changed files with 16 additions and 4 deletions

View File

@ -929,10 +929,22 @@ public class YoutubeStreamExtractor extends StreamExtractor {
int itag = formatData.getInt("itag"); int itag = formatData.getInt("itag");
if (ItagItem.isSupported(itag)) { if (ItagItem.isSupported(itag)) {
ItagItem itagItem = ItagItem.getItag(itag); try {
if (itagItem.itagType == itagTypeWanted) { ItagItem itagItem = ItagItem.getItag(itag);
String streamUrl = formatData.getString("url"); if (itagItem.itagType == itagTypeWanted) {
urlAndItags.put(streamUrl, itagItem); String streamUrl;
if (formatData.has("url")) {
streamUrl = formatData.getString("url");
} else {
// this url has an encrypted signature
Map<String, String> cipher = Parser.compatParseMap(formatData.getString("cipher"));
streamUrl = cipher.get("url") + "&" + cipher.get("sp") + "=" + decryptSignature(cipher.get("s"), decryptionCode);
}
urlAndItags.put(streamUrl, itagItem);
}
} catch (UnsupportedEncodingException ignored) {
} }
} }
} }