Return null if channel has no banner
This commit is contained in:
parent
1eca63089b
commit
a38ab9b791
|
@ -127,8 +127,11 @@ public class YoutubeChannelExtractor extends ChannelExtractor {
|
||||||
@Override
|
@Override
|
||||||
public String getBannerUrl() throws ParsingException {
|
public String getBannerUrl() throws ParsingException {
|
||||||
try {
|
try {
|
||||||
String url = initialData.getObject("header").getObject("c4TabbedHeaderRenderer").getObject("banner").getArray("thumbnails").getObject(0).getString("url");
|
String url = null;
|
||||||
if (url.contains("s.ytimg.com") || url.contains("default_banner")) {
|
try {
|
||||||
|
url = initialData.getObject("header").getObject("c4TabbedHeaderRenderer").getObject("banner").getArray("thumbnails").getObject(0).getString("url");
|
||||||
|
} catch (Exception ignored) {}
|
||||||
|
if (url == null || url.contains("s.ytimg.com") || url.contains("default_banner")) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
// the first characters of the banner URLs are different for each channel and some are not even valid URLs
|
// the first characters of the banner URLs are different for each channel and some are not even valid URLs
|
||||||
|
|
Loading…
Reference in New Issue