mirror of
https://github.com/TeamNewPipe/NewPipeExtractor.git
synced 2025-04-27 23:40:36 +05:30
Fix getThumbnailUrl() in YoutubeChannelInfoItemExtractor
This commit is contained in:
parent
51fb26625a
commit
c7360e4a46
@ -7,6 +7,9 @@ import org.schabi.newpipe.extractor.exceptions.ParsingException;
|
|||||||
import org.schabi.newpipe.extractor.services.youtube.linkHandler.YoutubeChannelLinkHandlerFactory;
|
import org.schabi.newpipe.extractor.services.youtube.linkHandler.YoutubeChannelLinkHandlerFactory;
|
||||||
import org.schabi.newpipe.extractor.utils.Utils;
|
import org.schabi.newpipe.extractor.utils.Utils;
|
||||||
|
|
||||||
|
import static org.schabi.newpipe.extractor.utils.Utils.HTTP;
|
||||||
|
import static org.schabi.newpipe.extractor.utils.Utils.HTTPS;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Created by Christian Schabesberger on 12.02.17.
|
* Created by Christian Schabesberger on 12.02.17.
|
||||||
*
|
*
|
||||||
@ -37,7 +40,16 @@ public class YoutubeChannelInfoItemExtractor implements ChannelInfoItemExtractor
|
|||||||
@Override
|
@Override
|
||||||
public String getThumbnailUrl() throws ParsingException {
|
public String getThumbnailUrl() throws ParsingException {
|
||||||
try {
|
try {
|
||||||
return channelInfoItem.getObject("thumbnail").getArray("thumbnails").getObject(0).getString("url");
|
String url = channelInfoItem.getObject("thumbnail").getArray("thumbnails").getObject(0).getString("url");
|
||||||
|
if (url.startsWith("//")) {
|
||||||
|
url = url.substring(2);
|
||||||
|
}
|
||||||
|
if (url.startsWith(HTTP)) {
|
||||||
|
url = Utils.replaceHttpWithHttps(url);
|
||||||
|
} else if (!url.startsWith(HTTPS)) {
|
||||||
|
url = HTTPS + url;
|
||||||
|
}
|
||||||
|
return url;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new ParsingException("Could not get thumbnail url", e);
|
throw new ParsingException("Could not get thumbnail url", e);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user