try YoutubeChannelExtractor.getName() hack try 2

This commit is contained in:
Christian Schabesberger 2017-09-09 22:11:16 +02:00
parent a6da202438
commit f308755359
2 changed files with 4 additions and 3 deletions

View File

@ -93,7 +93,8 @@ public class YoutubeChannelExtractor extends ChannelExtractor {
@Override @Override
public String getName() throws ParsingException { public String getName() throws ParsingException {
try { try {
return doc.select("span[class=\"qualified-channel-title-text\"]").first().select("a").first().text(); channelName = doc.select("span[class=\"qualified-channel-title-text\"]").first().select("a").first().text();
return channelName;
} catch (Exception e) { } catch (Exception e) {
throw new ParsingException("Could not get channel name", e); throw new ParsingException("Could not get channel name", e);
} }
@ -102,8 +103,7 @@ public class YoutubeChannelExtractor extends ChannelExtractor {
@Override @Override
public String getAvatarUrl() throws ParsingException { public String getAvatarUrl() throws ParsingException {
try { try {
channelName = doc.select("img[class=\"channel-header-profile-image\"]").first().attr("abs:src"); return doc.select("img[class=\"channel-header-profile-image\"]").first().attr("abs:src");
return channelName;
} catch (Exception e) { } catch (Exception e) {
throw new ParsingException("Could not get avatar", e); throw new ParsingException("Could not get avatar", e);
} }

View File

@ -6,6 +6,7 @@ import org.schabi.newpipe.Downloader;
import org.schabi.newpipe.extractor.ListExtractor; import org.schabi.newpipe.extractor.ListExtractor;
import org.schabi.newpipe.extractor.NewPipe; import org.schabi.newpipe.extractor.NewPipe;
import org.schabi.newpipe.extractor.channel.ChannelExtractor; import org.schabi.newpipe.extractor.channel.ChannelExtractor;
import org.schabi.newpipe.extractor.stream.StreamInfoItem;
import static org.junit.Assert.*; import static org.junit.Assert.*;
import static org.schabi.newpipe.extractor.ServiceList.YouTube; import static org.schabi.newpipe.extractor.ServiceList.YouTube;