Added method to download subtitles as VTT

This commit is contained in:
tonakriz
2017-11-23 00:10:12 +01:00
parent 6031695343
commit 6e3651fdf5
7 changed files with 43 additions and 41 deletions

View File

@@ -105,6 +105,6 @@ public class SoundcloudStreamExtractorDefaultTest {
@Test
public void testGetSubtitles() throws IOException, ExtractionException, JsonParserException {
assertTrue(extractor.getSubtitles() != null);
assertTrue(extractor.getSubtitlesList() != null);
}
}

View File

@@ -152,7 +152,18 @@ public class YoutubeStreamExtractorDefaultTest {
}
@Test
public void testGetSubtitles() throws IOException, ExtractionException, JsonParserException {
assertTrue(extractor.getSubtitles() != null);
public void testGetSubtitlesList() throws IOException, ExtractionException, JsonParserException {
assertTrue(extractor.getSubtitlesList() != null);
}
@Test
public void testDownloadSubtitles() throws Exception {
try {
extractor.downloadSubtitles(extractor.getSubtitlesList().get("en")[0]);
// Video has no subtitles!
assert false;
} catch (Exception e) {
assert true;
}
}
}

View File

@@ -106,7 +106,12 @@ public class YoutubeStreamExtractorRestrictedTest {
}
@Test
public void testGetSubtitles() throws IOException, ExtractionException, JsonParserException {
assertTrue(extractor.getSubtitles() != null);
public void testGetSubtitlesList() throws IOException, ExtractionException, JsonParserException {
assertTrue(extractor.getSubtitlesList() != null);
}
@Test
public void testDownloadSubtitles() throws Exception {
assertTrue(extractor.downloadSubtitles("https://youtu.be/FmG385_uUys?t=174") != null);
}
}