TimeForANinja / node-ytsr

Do anonymous YouTube search requests.
MIT License
284 stars 66 forks source link

Cannot read properties of undefined (reading 'reelPlayerHeaderRenderer') #174

Closed AlexanderWyss closed 1 year ago

AlexanderWyss commented 1 year ago

Error while parsing Shorts.

Code:

ytsr("test", { limit: 20 })

Log:

TypeError: Cannot read properties of undefined (reading 'reelPlayerHeaderRenderer') at parseShort (C:\Users\alexs\development\discord-bot-node\node_modules\ytsr\lib\parseItem.js:355:67) at parseItem (C:\Users\alexs\development\discord-bot-node\node_modules\ytsr\lib\parseItem.js:28:14) at C:\Users\alexs\development\discord-bot-node\node_modules\ytsr\lib\parseItem.js:409:30 at Array.map () at parseShelf (C:\Users\alexs\development\discord-bot-node\node_modules\ytsr\lib\parseItem.js:409:21) at parseItem (C:\Users\alexs\development\discord-bot-node\node_modules\ytsr\lib\parseItem.js:32:14) at catchAndLogFunc (C:\Users\alexs\development\discord-bot-node\node_modules\ytsr\lib\parseItem.js:88:12) at module.exports (C:\Users\alexs\development\discord-bot-node\node_modules\ytsr\lib\parseItem.js:111:46) at C:\Users\alexs\development\discord-bot-node\node_modules\ytsr\lib\main.js:53:34 at Array.map ()

/**** failed at func parseItem: Cannot read properties of undefined (reading 'reelPlayerHeaderRenderer') pls post the the files in C:\Users\alexs\development\discord-bot-node\node_modules\ytsr\dumps to https://github.com/TimeForANinja/node-ytsr/issues os: win32-x64, node.js: v16.13.0, ytsr: 3.8.0 ****\

Relevant ytsr code:

const parseShort = obj => { const playerHeader = obj.navigationEndpoint.reelWatchEndpoint.overlay .reelPlayerOverlayRenderer.reelPlayerHeaderSupportedRenderers.reelPlayerHeaderRenderer;

Dumps:

w4v30m7nxg-1673000032404.txt n6qohp7t1k-1673000874734.txt

LostAndDead commented 1 year ago

Also encountering this problem as of yesterday doesn't seem to completely break or happen all the time.

SiSchu commented 1 year ago

This also encountered in my code. This never crashed something but a fix for that to not send an error to the console would be nice.

Yonle commented 1 year ago

Reproduceable

TypeError: Cannot read properties of undefined (reading 'reelPlayerHeaderRenderer')
    at parseShort (/.../node_modules/ytsr/lib/parseItem.js:355:67)                                                               at parseItem (/..../node_modules/ytsr/lib/parseItem.js:28:14)                                                                 at 
/..../node_modules/ytsr/lib/parseItem.js:409:30
    at Array.map (<anonymous>)
    at parseShelf (/..../node_modules/ytsr/lib/parseItem.js:409:21)
    at parseItem (/..../node_modules/ytsr/lib/parseItem.js:32:14)                                                                 at catchAndLogFunc (/..../node_modules/ytsr/lib/parseItem.js:88:12)                                                           at module.exports (/..../node_modules/ytsr/lib/parseItem.js:111:46)                                                           at /...../node_modules/ytsr/lib/main.js:53:34            at Array.map (<anonymous>)                                                                                                              /********************************************************************************************************************************************************************************************************         failed at func parseItem: Cannot read properties of undefined (reading 'reelPlayerHeaderRenderer')                                          pls post the the files in /..../node_modules/ytsr/dumps to https://github.com/TimeForANinja/node-ytsr/issues
os: openbsd-x64, node.js: v16.17.1, ytsr: 3.8.0                       ********************************************************************************************************************************************************************************************************\
Nik0lovD commented 1 year ago

failed at func parseItem: Cannot read properties of undefined (reading 'reelPlayerHeaderRenderer') pls post the the files in /home/container/node_modules/ytsr/dumps to https://github.com/TimeForANinja/node-ytsr/issues os: linux-x64, node.js: v16.19.0, ytsr: 3.8.0

Yonle commented 1 year ago

Appearently this happens when parsing shorts video.

ytsr is trying to parse the short's author/channel/owner: https://github.com/TimeForANinja/node-ytsr/blob/master/lib/parseItem.js#L353-L356

However, Youtube did not give any metadata about the author/owner: Screenshot_2023_0115_211820.png

Which led to this error:

TypeError: Cannot read properties of undefined (reading 'reelPlayerHeaderRenderer')

This could be fixed by checking whenever there's reelPlayerHeaderSupportedRenderers or no, However with an consequence, An channel object that return null

abaza738 commented 1 year ago

I came to report the same issue.
Is the solution merged yet?

RisedSky commented 1 year ago

i have the same error

CoroNaut commented 1 year ago

same error

github-actions[bot] commented 1 year ago

:tada: This issue has been resolved in version 3.8.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket: