From 7cd410f3fc304a9eb620fa28ba39f938e4565c2b Mon Sep 17 00:00:00 2001 From: Stypox Date: Thu, 9 Apr 2020 14:45:33 +0200 Subject: [PATCH] [YouTube] Return 0 when there is no timestamp, not -2, as per javadoc --- .../youtube/extractors/YoutubeStreamExtractor.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeStreamExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeStreamExtractor.java index 08e43d6fd..bdaf4cadd 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeStreamExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeStreamExtractor.java @@ -253,7 +253,14 @@ public class YoutubeStreamExtractor extends StreamExtractor { */ @Override public long getTimeStamp() throws ParsingException { - return getTimestampSeconds("((#|&|\\?)(t|start)=\\d{0,3}h?\\d{0,3}m?\\d{1,3}s?)"); + long timestamp = getTimestampSeconds("((#|&|\\?)t=\\d{0,3}h?\\d{0,3}m?\\d{1,3}s?)"); + + if (timestamp == -2) { + // regex for timestamp was not found + return 0; + } else { + return timestamp; + } } @Override