Fix extracting the subscriber count from channel PageHeader nodes (#4804)

This commit is contained in:
absidue 2024-03-27 02:35:34 +01:00 committed by GitHub
parent 4023bfa9c9
commit b04e349b06
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 1 deletions

View File

@ -513,7 +513,13 @@ export function parseLocalChannelHeader(channel) {
}
if (header.content.metadata) {
subscriberText = header.content.metadata.metadata_rows[0].metadata_parts[1].text.text
// YouTube has already changed the indexes for where the information is stored once,
// so we should search for it instead of using hardcoded indexes, just to be safe for the future
subscriberText = header.content.metadata.metadata_rows
.flatMap(row => row.metadata_parts ? row.metadata_parts : [])
.find(part => part.text.text?.includes('subscriber'))
?.text.text
}
break