fix playlist banner foo
This commit is contained in:
parent
b1130629bb
commit
fce324d1bc
|
@ -74,21 +74,9 @@ public class YoutubePlaylistExtractor extends PlaylistExtractor {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getBannerUrl() throws ParsingException {
|
public String getBannerUrl() {
|
||||||
try {
|
return ""; // Banner can't be handled by frontend right now.
|
||||||
Element el = doc.select("div[id=\"gh-banner\"] style").first();
|
// Whoever is willing to implement this should also implement this in the fornt end
|
||||||
String cssContent = el.html();
|
|
||||||
String url = "https:" + Parser.matchGroup1("url\\((.*)\\)", cssContent);
|
|
||||||
if (url.contains("s.ytimg.com")) {
|
|
||||||
return null;
|
|
||||||
} else {
|
|
||||||
return url.substring(0, url.indexOf(");"));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new ParsingException("Could not get playlist Banner");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -55,6 +55,7 @@ public class YoutubePlaylistExtractorTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetBannerUrl() throws Exception {
|
public void testGetBannerUrl() throws Exception {
|
||||||
|
System.out.println(extractor.getBannerUrl());
|
||||||
assertTrue(extractor.getBannerUrl(), extractor.getBannerUrl().contains("yt"));
|
assertTrue(extractor.getBannerUrl(), extractor.getBannerUrl().contains("yt"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue