Improve documentation

> > I think you can use YoutubeParsingHelper.getTextFromObject()
> That was used there before however I did not choose to use it again.
>
> ``runs`` returns an array with 3 items containing:
> 0: ``<artistname>``
> 1: ``•``
> 2: ``<subscriberCount>``
>
> There is 2 problems with that:
> 1. It's inefficient for extracting the subscription count
> 2. If for some reason the artist now has a name like "2k" the extraction malfunctions

See also: https://github.com/TeamNewPipe/NewPipeExtractor/pull/1277#discussion_r1955148742
This commit is contained in:
litetex 2025-02-15 15:02:30 +01:00
parent 3ad9f17c53
commit e4081243e7
No known key found for this signature in database
GPG Key ID: 525B43E6039B3689

View File

@ -68,6 +68,8 @@ public class YoutubeMusicArtistInfoItemExtractor implements ChannelInfoItemExtra
.getObject("musicResponsiveListItemFlexColumnRenderer")
.getObject("text")
.getArray("runs");
// NOTE: YoutubeParsingHelper#getTextFromObject would use all entries from the run array,
// which is not wanted as only the last entry contains the actual subscriberCount
final String subscriberCount = runs.getObject(runs.size() - 1)
.getString("text");
if (!isNullOrEmpty(subscriberCount)) {