M
M
Michael Compass2021-09-01 22:44:37
npm
Michael Compass, 2021-09-01 22:44:37

Node JS for Youtube search. Why is the log empty?

NPM Module " youtube-search " link
..... for Node JS (version 12.18.3) searches
for 500 videos for the search term "music" and logs the results.

Youtube APIv3 key: AIzaSyALTsN37OKneqTEQskMWVLb32Cumv-3bGc

Why doesn't it show anything in the log?

Don't kick too hard, I'm far from manually writing code in JS.

The code:

var search = require('youtube-search');

var opts = {
  maxResults: 500,
  key: 'AIzaSyALTsN37OKneqTEQskMWVLb32Cumv-3bGc'
};

search('музыка', opts, function(err, results) {
  if(err) return console.log(err);

 = results

  console.dir(results);
});


to output the result to the console, my interpreter software needs to write the result to a variable.

like this, but my soft interpreter says that the RESULTAT variable is not defined

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question