fix could not parese metadata despide available error

This commit is contained in:
Christian Schabesberger 2018-05-04 16:11:25 +02:00
parent bad67f0bc3
commit bf1c771662
2 changed files with 5 additions and 0 deletions

View file

@ -135,7 +135,11 @@ public class YoutubeStreamInfoItemExtractor implements StreamInfoItemExtractor {
Element meta = item.select("div[class=\"yt-lockup-meta\"]").first(); Element meta = item.select("div[class=\"yt-lockup-meta\"]").first();
if (meta == null) return -1; if (meta == null) return -1;
// This case can happen if google releases a special video
if(meta.select("li").size() < 2) return -1;
input = meta.select("li").get(1).text(); input = meta.select("li").get(1).text();
} catch (IndexOutOfBoundsException e) { } catch (IndexOutOfBoundsException e) {
throw new ParsingException("Could not parse yt-lockup-meta although available: " + getUrl(), e); throw new ParsingException("Could not parse yt-lockup-meta although available: " + getUrl(), e);
} }

View file

@ -48,6 +48,7 @@ public class YoutubeTrendingExtractorTest {
.getKioskList() .getKioskList()
.getExtractorById("Trending", null); .getExtractorById("Trending", null);
extractor.fetchPage(); extractor.fetchPage();
extractor.setContentCountry("de");
} }
@Test @Test