mirror of
https://github.com/TeamNewPipe/NewPipeExtractor.git
synced 2025-04-27 23:40:36 +05:30
Fix YT artist getSubscriberCount extraction
This commit is contained in:
parent
25e4a6f3cf
commit
4d7df1486c
@ -1,5 +1,6 @@
|
|||||||
package org.schabi.newpipe.extractor.services.youtube.extractors;
|
package org.schabi.newpipe.extractor.services.youtube.extractors;
|
||||||
|
|
||||||
|
import com.grack.nanojson.JsonArray;
|
||||||
import com.grack.nanojson.JsonObject;
|
import com.grack.nanojson.JsonObject;
|
||||||
import org.schabi.newpipe.extractor.Image;
|
import org.schabi.newpipe.extractor.Image;
|
||||||
import org.schabi.newpipe.extractor.channel.ChannelInfoItemExtractor;
|
import org.schabi.newpipe.extractor.channel.ChannelInfoItemExtractor;
|
||||||
@ -61,10 +62,14 @@ public class YoutubeMusicArtistInfoItemExtractor implements ChannelInfoItemExtra
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long getSubscriberCount() throws ParsingException {
|
public long getSubscriberCount() throws ParsingException {
|
||||||
final String subscriberCount = getTextFromObject(artistInfoItem.getArray("flexColumns")
|
final JsonArray flexColumns = artistInfoItem.getArray("flexColumns");
|
||||||
.getObject(2)
|
final JsonArray runs = flexColumns
|
||||||
|
.getObject(flexColumns.size() - 1)
|
||||||
.getObject("musicResponsiveListItemFlexColumnRenderer")
|
.getObject("musicResponsiveListItemFlexColumnRenderer")
|
||||||
.getObject("text"));
|
.getObject("text")
|
||||||
|
.getArray("runs");
|
||||||
|
final String subscriberCount = runs.getObject(runs.size() - 1)
|
||||||
|
.getString("text");
|
||||||
if (!isNullOrEmpty(subscriberCount)) {
|
if (!isNullOrEmpty(subscriberCount)) {
|
||||||
try {
|
try {
|
||||||
return Utils.mixedNumberWordToLong(subscriberCount);
|
return Utils.mixedNumberWordToLong(subscriberCount);
|
||||||
|
@ -4,7 +4,6 @@ import static org.schabi.newpipe.extractor.ServiceList.YouTube;
|
|||||||
import static java.util.Collections.singletonList;
|
import static java.util.Collections.singletonList;
|
||||||
|
|
||||||
import org.junit.jupiter.api.BeforeAll;
|
import org.junit.jupiter.api.BeforeAll;
|
||||||
import org.junit.jupiter.api.Disabled;
|
|
||||||
import org.schabi.newpipe.downloader.DownloaderTestImpl;
|
import org.schabi.newpipe.downloader.DownloaderTestImpl;
|
||||||
import org.schabi.newpipe.extractor.InfoItem;
|
import org.schabi.newpipe.extractor.InfoItem;
|
||||||
import org.schabi.newpipe.extractor.NewPipe;
|
import org.schabi.newpipe.extractor.NewPipe;
|
||||||
@ -107,7 +106,6 @@ public class YoutubeMusicSearchExtractorTest {
|
|||||||
@Override public InfoItem.InfoType expectedInfoItemType() { return InfoItem.InfoType.PLAYLIST; }
|
@Override public InfoItem.InfoType expectedInfoItemType() { return InfoItem.InfoType.PLAYLIST; }
|
||||||
}
|
}
|
||||||
|
|
||||||
@Disabled
|
|
||||||
public static class MusicArtists extends DefaultSearchExtractorTest {
|
public static class MusicArtists extends DefaultSearchExtractorTest {
|
||||||
private static SearchExtractor extractor;
|
private static SearchExtractor extractor;
|
||||||
private static final String QUERY = "kevin";
|
private static final String QUERY = "kevin";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user