Skip to content

Commit

Permalink
Support start= timestamps for YouTube
Browse files Browse the repository at this point in the history
  • Loading branch information
wb9688 committed Jul 6, 2020
1 parent 54d9e5a commit 156a26b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ public long getLength() throws ParsingException {
*/
@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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ public void testGetInvalidTimeStamp() throws ParsingException {
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
Expand Down

0 comments on commit 156a26b

Please sign in to comment.