parent
1f1bbaad57
commit
b3699cdcfc
|
@ -716,7 +716,7 @@ public class YoutubeStreamExtractor extends StreamExtractor {
|
|||
final Document listing = Jsoup.parse(pageContent, listingUrl);
|
||||
final Elements tracks = listing.select("track");
|
||||
|
||||
List<Subtitles> subtitles = new ArrayList<>(tracks.size() * 5);
|
||||
List<Subtitles> subtitles = new ArrayList<>(tracks.size() * 2);
|
||||
for (final Element track : tracks) {
|
||||
final String languageCode = track.attr("lang_code");
|
||||
subtitles.add(getVideoSubtitlesUrl(id, languageCode, SubtitlesFormat.TTML));
|
||||
|
@ -761,7 +761,7 @@ public class YoutubeStreamExtractor extends StreamExtractor {
|
|||
@Nonnull
|
||||
private static Subtitles getVideoSubtitlesUrl(final String id, final String locale, final SubtitlesFormat format) {
|
||||
final String url = "https://www.youtube.com/api/timedtext?lang=" + locale +
|
||||
"&fmt=" + format.getExtension() + "&name=&v=" + id;
|
||||
"&fmt=" + format.getExtension() + "&v=" + id;
|
||||
// These are all non-generated
|
||||
return new Subtitles(format, locale, url, false);
|
||||
}
|
||||
|
|
|
@ -109,12 +109,12 @@ public class SoundcloudStreamExtractorDefaultTest {
|
|||
@Test
|
||||
public void testGetSubtitlesListDefault() throws IOException, ExtractionException {
|
||||
// Video (/view?v=YQHsXMglC9A) set in the setUp() method has no captions => null
|
||||
assertTrue(extractor.getSubtitlesDefault() == null);
|
||||
assertTrue(extractor.getSubtitlesDefault().isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetSubtitlesList() throws IOException, ExtractionException {
|
||||
// Video (/view?v=YQHsXMglC9A) set in the setUp() method has no captions => null
|
||||
assertTrue(extractor.getSubtitles(SubtitlesFormat.VTT) == null);
|
||||
assertTrue(extractor.getSubtitlesDefault().isEmpty());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -153,6 +153,6 @@ public class YoutubeStreamExtractorDefaultTest {
|
|||
@Test
|
||||
public void testGetSubtitlesList() throws IOException, ExtractionException {
|
||||
// Video (/view?v=YQHsXMglC9A) set in the setUp() method has no captions => null
|
||||
assertTrue(extractor.getSubtitles(SubtitlesFormat.VTT).isEmpty());
|
||||
assertTrue(extractor.getSubtitlesDefault().isEmpty());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue