-Fixed tests

-Simplified subtitle extraction url
This commit is contained in:
John Zhen Mo 2018-02-01 19:07:57 -08:00
parent 1f1bbaad57
commit b3699cdcfc
3 changed files with 5 additions and 5 deletions

View File

@ -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);
}

View File

@ -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());
}
}

View File

@ -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());
}
}