【问题标题】:Channels: list API not returning all channels频道:列表 API 未返回所有频道
【发布时间】:2015-10-15 13:46:39
【问题描述】:

我正在使用 Channels: list API (https://developers.google.com/youtube/v3/docs/channels/list) 来获取 managedByMe 和 onBehalfOfContentOwner 的所有频道

YouTube CMS 中的 API、频道概览和导出所有频道表示 1172 个频道

但在轮询 API 时,我只得到 1092 个通道,即使 API 本身返回 'totalResults': 1172

nextPageToken, channels = None, []
while channels == [] or nextPageToken is not None:
    results = service.channels().list(part='id', managedByMe=True, onBehalfOfContentOwner=CONTENT_OWNER_ID,
                                      maxResults=50, pageToken=nextPageToken).execute()
    channels.extend([item['id'] for item in results['items']])
    print(len(results['items']))
    nextPageToken = results.get('nextPageToken', None)
print(len(channels))

输出:

50
50
49
48
50
50
50
50
50
48
50
44
49
44
47
47
43
44
36
43
41
44
45
20
1092

是我犯了一些愚蠢的错误,还是 API 根本不可靠?

【问题讨论】:

    标签: youtube-api youtube-data-api


    【解决方案1】:

    频道丢失的原因是它们被暂停了!

    不幸的是,API 文档没有提到 API 中跳过了暂停通道,即使它们包含在 totalResults 中

    导出的 CSV 中也不包含暂停状态

    【讨论】:

      猜你喜欢
      • 2018-12-25
      • 1970-01-01
      • 2021-12-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-02-28
      • 2020-10-13
      • 1970-01-01
      相关资源
      最近更新 更多