DrKain / scrape-youtube

A lightning fast package to scrape YouTube search results
MIT License
108 stars 30 forks source link

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

Closed shidemuri closed 2 years ago

shidemuri commented 2 years ago

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"

DrKain commented 2 years ago

Can you provide an example of the conflict?

shidemuri commented 2 years ago
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]
DrKain commented 2 years ago

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)
shidemuri commented 2 years ago

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