twlite / youtube-sr

A dead-simple youtube metadata scraper
https://npmjs.com/package/youtube-sr
MIT License
115 stars 15 forks source link

Error when search type is playlist #44

Closed AayushGour closed 2 years ago

AayushGour commented 2 years ago

When I try to search with a particular word and the type is set to "playlist" then I'm facing the following Issue.

TypeError: this.thumbnail.toJSON is not a function at Playlist.toJSON (node_modules\youtube-sr\dist\mod.js:266:33)

Here is my Code...

let searchData = await YouTube.search(searchParam, { limit: 10, type: "playlist" })

twlite commented 2 years ago

@AayushGour 🤔 the code you've provided

let searchData = await YouTube.search(searchParam, { limit: 10, type: "playlist" })

isnt actually helping me reproduce this issue. Could you provide your full code snippet if possible? The Youtube.search would not call Playlist.toJSON, it would instead return the Playlist class. Is there anything else in your code such as json stringifying the searchData?

this.thumbnail.toJSON seems to be a case of missing thumbnail data, I will look into it 👍

twlite commented 2 years ago

https://github.com/DevAndromeda/youtube-sr/commit/79e0dd15d02024ca530c86bb98d8ffd63cf5882f should fix the issue related to TypeError: this.thumbnail.toJSON is not a function at Playlist.toJSON (node_modules\youtube-sr\dist\mod.js:266:33)

twlite commented 2 years ago

I've published v4.1.18 with this update.

Closing this issue due to inactivity, reopen if needed.