Add fallback for urls not conaining the "sp" tag

If ever YouTube changes thing again (or uses old urls for some unknown reason), this prevents the extractor from crashing.
As suggested here: 133cc032d9 (r283529811)
pull/163/head
Stypox 2019-05-14 13:57:45 +02:00
rodzic 133cc032d9
commit c70d28597b
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4BDF1B40A49FDD23
1 zmienionych plików z 7 dodań i 1 usunięć

Wyświetl plik

@ -888,7 +888,13 @@ public class YoutubeStreamExtractor extends StreamExtractor {
String streamUrl = tags.get("url");
// if video has a signature: decrypt it and add it to the url
if (tags.get("s") != null) {
streamUrl = streamUrl + "&" + tags.get("sp") + "=" + decryptSignature(tags.get("s"), decryptionCode);
if (tags.get("sp") == null) {
// fallback for urls not conaining the "sp" tag
streamUrl = streamUrl + "&signature=" + decryptSignature(tags.get("s"), decryptionCode);
}
else {
streamUrl = streamUrl + "&" + tags.get("sp") + "=" + decryptSignature(tags.get("s"), decryptionCode);
}
}
urlAndItags.put(streamUrl, itagItem);
}