Skip to content

Commit acebbaf

Browse files
authored
Merge pull request #163 from Stypox/youtube-url-signature-fix
Fix invalid yt url: signature tag name is not always "signature"
2 parents d22786b + c70d285 commit acebbaf

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeStreamExtractor.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -888,7 +888,13 @@ private Map<String, ItagItem> getItags(String encodedUrlMapKey, ItagItem.ItagTyp
888888
String streamUrl = tags.get("url");
889889
// if video has a signature: decrypt it and add it to the url
890890
if (tags.get("s") != null) {
891-
streamUrl = streamUrl + "&signature=" + decryptSignature(tags.get("s"), decryptionCode);
891+
if (tags.get("sp") == null) {
892+
// fallback for urls not conaining the "sp" tag
893+
streamUrl = streamUrl + "&signature=" + decryptSignature(tags.get("s"), decryptionCode);
894+
}
895+
else {
896+
streamUrl = streamUrl + "&" + tags.get("sp") + "=" + decryptSignature(tags.get("s"), decryptionCode);
897+
}
892898
}
893899
urlAndItags.put(streamUrl, itagItem);
894900
}

0 commit comments

Comments
 (0)