{"size": 1049, "ext": "js", "max_stars_repo_path": "server/lib/playlists.js", "max_stars_repo_name": "jcantara/resume-tube", "max_stars_repo_stars_event_min_datetime": "2016-03-06T04:07:14.000Z", "max_stars_repo_stars_event_max_datetime": "2018-03-17T00:34:35.000Z", "max_issues_repo_path": "server/lib/playlists.js", "max_issues_repo_name": "jcantara/resume-tube", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "server/lib/playlists.js", "max_forks_repo_name": "jcantara/resume-tube", "max_forks_repo_forks_event_min_datetime": "2021-06-10T02:48:01.000Z", "max_forks_repo_forks_event_max_datetime": "2021-06-10T02:48:01.000Z"}
{"max_stars_count": 3, "max_issues_count": null, "max_forks_count": 1, "avg_line_length": 33.8387096774, "max_line_length": 115, "alphanum_fraction": 0.6167778837}
fetchPlaylistMetaData = function(ids) {
  if(typeof(ids) == "string") {
    ids = [ids];
  }
  var playlists = Playlists.find({_id: {$in: ids}});
  var playlistListIds = playlists.map(function(playlist){
    return playlist.list;
  });
  playlists = playlists.fetch();
  HTTP.get("https://www.googleapis.com/youtube/v3/playlists",{params:
    {
      id: playlistListIds.join(','),
      part: "snippet,contentDetails",
      key: Meteor.settings.youtubeApiKey
    }
  }, function(err, data) {
    if (!err) {
      data["data"]["items"].forEach(function(apiPlaylist){
        var playlist = null;
        playlist = _.find(playlists, function(pl){return pl.list === apiPlaylist.id});
        if(playlist) {
          var title = apiPlaylist["snippet"]["title"]
          var itemCount = apiPlaylist["contentDetails"]["itemCount"]
          var channelTitle = apiPlaylist["snippet"]["channelTitle"]
          Playlists.update(playlist._id, {$set: {title: title, itemCount: itemCount, channelTitle: channelTitle}});
        }
      });
    }
  });
}
