Skip to content

Commit bf1c771

Browse files
committed
fix could not parese metadata despide available error
1 parent bad67f0 commit bf1c771

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamInfoItemExtractor.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,11 @@ public long getViewCount() throws ParsingException {
135135
Element meta = item.select("div[class=\"yt-lockup-meta\"]").first();
136136
if (meta == null) return -1;
137137

138+
// This case can happen if google releases a special video
139+
if(meta.select("li").size() < 2) return -1;
140+
138141
input = meta.select("li").get(1).text();
142+
139143
} catch (IndexOutOfBoundsException e) {
140144
throw new ParsingException("Could not parse yt-lockup-meta although available: " + getUrl(), e);
141145
}

extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeTrendingExtractorTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ public static void setUp() throws Exception {
4848
.getKioskList()
4949
.getExtractorById("Trending", null);
5050
extractor.fetchPage();
51+
extractor.setContentCountry("de");
5152
}
5253

5354
@Test

0 commit comments

Comments
 (0)