【问题标题】:Youtube API v3 return only 19 NextPageToken for any requestYoutube API v3 对任何请求仅返回 19 NextPageToken
【发布时间】:2018-08-28 08:13:28
【问题描述】:

我尝试使用 youtube API 获取 80k 视频 ID,但 youtube API 仅返回前 19 个页面,在 NextPageToken == undefined 之后,我尝试使用其他关键字和其他请求并遇到同样的问题。

async.eachSeries(check_array, function iterator(value, callback) {
            console.log(next_page);

            var params = {
                q: q,
                part: 'snippet',
                maxResults: max,
                order: 'title'

            }

            if(next_page){
                params.pageToken = next_page;
            }

            client.search(params, function (err, data) {
                //console.log(data);
                if (err) throw err;

                if(data.nextPageToken === "undefined"){

                    console.log('Its end');

                }else{
                    next_page = data.nextPageToken;
                     data.items.forEach(function (value, index) {
                         connection.query('INSERT IGNORE INTO videos (video_id,uploaded) VALUES ("'+value.id.videoId+'",false)',
                             function (error, results, fields) {
                                if (error) throw error;
                            });
                     });

                    callback();
                }


            });
        });

【问题讨论】:

  • 我猜 youtube 想防止有人烧烤他们的服务器。
  • 这很奇怪,因为 youtube 有 1,000,000 个 API 积分,一个请求需要 100 个积分,我大概可以解析 500,000 个视频,因为一个请求 = 50 个视频

标签: javascript node.js youtube youtube-api youtube-data-api


【解决方案1】:

YouTube 的软搜索限制为 500 个视频,与总结果无关。

How can get all results from Youtube API (search API) response

【讨论】:

    猜你喜欢
    • 2019-08-05
    • 2016-11-28
    • 2017-06-15
    • 2019-02-06
    • 2017-11-29
    • 2019-05-13
    • 2018-12-13
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多