Skip to content

Commit c70d285

Browse files
committed
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: https://github.com/TeamNewPipe/NewPipeExtractor/pull/163/files/133cc032d9987130927e4c00e78e9fdbca1331dd#r283529811
1 parent 133cc03 commit c70d285

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 + "&" + tags.get("sp") + "=" + 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)