From 156a26b64bec831180f9f0cda264a2e18fb6622d Mon Sep 17 00:00:00 2001 From: wb9688 Date: Mon, 6 Jul 2020 14:08:40 +0200 Subject: [PATCH] Support start= timestamps for YouTube --- .../services/youtube/extractors/YoutubeStreamExtractor.java | 2 +- .../youtube/stream/YoutubeStreamExtractorAgeRestrictedTest.java | 2 ++ 2 files changed, 3 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 bdc2a10f3..dca5e5fb5 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 @@ -240,7 +240,7 @@ public class YoutubeStreamExtractor extends StreamExtractor { */ @Override public long getTimeStamp() throws ParsingException { - return getTimestampSeconds("((#|&|\\?)t=\\d{0,3}h?\\d{0,3}m?\\d{1,3}s?)"); + return getTimestampSeconds("((#|&|\\?)(t|start)=\\d{0,3}h?\\d{0,3}m?\\d{1,3}s?)"); } @Override diff --git a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/stream/YoutubeStreamExtractorAgeRestrictedTest.java b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/stream/YoutubeStreamExtractorAgeRestrictedTest.java index 3710b4ee1..95c8aeb43 100644 --- a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/stream/YoutubeStreamExtractorAgeRestrictedTest.java +++ b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/stream/YoutubeStreamExtractorAgeRestrictedTest.java @@ -48,6 +48,8 @@ public class YoutubeStreamExtractorAgeRestrictedTest { public void testGetValidTimeStamp() throws IOException, ExtractionException { StreamExtractor extractor = YouTube.getStreamExtractor("https://youtu.be/FmG385_uUys?t=174"); assertEquals(extractor.getTimeStamp() + "", "174"); + extractor = YouTube.getStreamExtractor("https://youtube.com/embed/FmG385_uUys?start=174"); + assertEquals(extractor.getTimeStamp() + "", "174"); } @Test