Merge pull request #163 from Stypox/youtube-url-signature-fix

Fix invalid yt url: signature tag name is not always "signature"
This commit is contained in:
Tobias Groza 2019-05-14 21:29:31 +02:00 committed by GitHub
commit acebbaf073
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 1 deletions

View File

@ -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 + "&signature=" + 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);
}