2

I have tried to get collection of search results like this with nodejs https://developers.google.com/youtube/v3/docs/search/list#usage

and there is function

function searchListByKeyword(auth, requestData) {
  var service = google.youtube('v3');
  var parameters = removeEmptyParameters(requestData['params']);
  parameters['auth'] = auth;
  service.search.list(parameters, function(err, response) {
    if (err) {
      console.log('The API returned an error: ' + err);
      return;
    }
    console.log(response);
  });
}

the fucntion must return a collection of search results, but in my case it returns Request

$ node quickstart
Request {
  _events:
   { error: [Function: bound ],
     complete: [Function: bound ],
     pipe: [Function] },
  _eventsCount: 3,
  _maxListeners: undefined,
  url: 'https://www.googleapis.com/youtube/v3/search',
  method: 'GET',
  paramsSerializer: [Function],
  headers:
   { 'Accept-Encoding': 'gzip',
     'User-Agent': 'google-api-nodejs-client/28.1.0 (gzip) google-api-nodejs-client/0.12.0',
     Authorization: 'Bearer ya29.GluVBXvsx3nP15QlV-MqcypX1eEvDQ3BuXttbfQyR7ZlTpfO26sZnrh7Sl0sWsOCdGsJWHpHtE9XJv0jDqoWmVOZoJbQLqqQs3ujIPlATDQBHxu5nNorO8JBCE6y',
     host: 'www.googleapis.com' },
  params: { maxResults: '25', part: 'snippet', q: 'surfing', type: 'qwe' },
  maxContentLength: 2147483648,
  validateStatus: [Function],
  uri:
   Url {
     protocol: 'https:',
     slashes: true,

and after all this throws an error

C:\Users\wwwba\Desktop\youtube\node_modules\google-auth-library\lib\auth\oauth2client.js:341
        callback(err, result, response);
        ^

TypeError: callback is not a function
    at OAuth2Client.postRequest (C:\Users\wwwba\Desktop\youtube\node_modules\google-auth-library\lib\auth\oauth2client.js:341:9)
    at postRequestCb (C:\Users\wwwba\Desktop\youtube\node_modules\google-auth-library\lib\auth\oauth2client.js:297:23)
    at Request._callback (C:\Users\wwwba\Desktop\youtube\node_modules\google-auth-library\lib\transporters.js:113:17)
    at Request.self.callback (C:\Users\wwwba\Desktop\youtube\node_modules\request\request.js:186:22)
    at Request.emit (events.js:180:13)
    at Request.<anonymous> (C:\Users\wwwba\Desktop\youtube\node_modules\request\request.js:1163:10)
    at Request.emit (events.js:180:13)
    at IncomingMessage.<anonymous> (C:\Users\wwwba\Desktop\youtube\node_modules\request\request.js:1085:12)
    at Object.onceWrapper (events.js:272:13)
    at IncomingMessage.emit (events.js:185:15)

can anyone tell me what i'm doing wrong. Thanks

1 Answer 1

2

the solution is simple than i think. i uninstall googleapis and google-auth-library and install their old versions

 "google-auth-library": "^0.12.0",
 "googleapis": "^21.3.0"

google, rewrite your api for new versions or warn that we MUST INSTALL OLD VERSIONS

Sign up to request clarification or add additional context in comments.

2 Comments

Thank you worked for me! I guess people at google don't have time to update docs for average mortals like us :(
Thanks for posting the solution you found. :) Consider accepting it so others can see that the problem was solved.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.