DrKain/scrape-youtube

the link string on response objects conflicts with the String.link() function

Closed this issue · 4 comments

Im using node v14.18.0 and when i try call the link string from a response object it returns the String.link() function instead
A solution to this could be replacing all "links" with "url"

Can you provide an example of the conflict?

const results = await youtube.search(url, {type: "video"})
const videos = []
for(const a in results.videos) videos.push(a.url) //a.url returns [Function: link]

There is no conflict. The issue is in your for... loop.
It should be:

for(const a of results.videos)

instead of:

for(const a in results.videos)

oh makes sense now, that in and of thing is easy to mess up