使用 youtube API v3 时订单不起作用 [英] Order doesn't work when using youtube API v3

查看:23
本文介绍了使用 youtube API v3 时订单不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试获取某个频道的最后 10 个视频.当我运行以下代码时:

I am trying to get the last 10 videos of a channel. When I run the following code:

from apiclient.discovery import build
API_SERVICE_NAME = "youtube"
API_VERSION = "v3"

def youtubeTest():
    KEY = "my key here"
    service = build(API_SERVICE_NAME, API_VERSION , developerKey=KEY)           
    args = {}
    args['part']='snippet'
    args['maxResults']='10'
    args['channelId']='UCq-Fj5jknLsUf-MWSy4_brA'
    args['order']='date'
    args['type']='video'
    results = service.search().list(**args).execute()

    items = results['items']
    for item in items:
        print item['snippet']['publishedAt']


youtubeTest()

这是我得到的结果

2018-03-13T10:33:45.000Z
2018-03-07T10:19:59.000Z
2017-11-22T04:30:00.000Z
2012-05-06T07:47:37.000Z 
2014-10-08T13:26:35.000Z
2017-08-10T13:39:17.000Z
2018-07-28T08:45:00.000Z
2018-12-26T05:53:46.000Z
2014-07-11T13:36:08.000Z
2018-07-12T05:30:09.000Z

我想要最后十个视频,但这不是正确的顺序.这段代码在过去几个月一直有效,但我最近遇到了问题.

I want the last ten videos but this is not the correct order. This piece of code was working for last few months but I am having the problem recently.

推荐答案

后续问题 #128673552,https://issuetracker.google.com/issues/128673552.

Follow-up on issue #128673552, https://issuetracker.google.com/issues/128673552.

这篇关于使用 youtube API v3 时订单不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆