【问题标题】:How to retrieve the recents video uploaded on friend's channel?如何检索上传到朋友频道的最近视频?
【发布时间】:2013-11-08 09:27:34
【问题描述】:

理论上这是我需要的 api:

https://developers.google.com/youtube/2.0/developers_guide_protocol_subscriptions#Retrieving_new_subscription_videos

事实上,如果我点击https://www.youtube.com/my_subscriptions,我会看到朋友最近上传的视频(订阅)。

但是调用那个端点 (alt=json) 我得到了这个:

{
    "version": "1.0",
    "encoding": "UTF-8",
    "feed": {
        "xmlns": "http://www.w3.org/2005/Atom",
        "xmlns$openSearch": "http://a9.com/-/spec/opensearch/1.1/",
        "xmlns$gd": "http://schemas.google.com/g/2005",
        "gd$etag": "W/\"CEIMSHwyfSp7I2A9Wh5QGU0.\"",
        "id": {
            "$t": "tag:youtube.com,2008:user:ysWGKld9kilWfiqcfr1pfQ:newsubscriptionvideos"
        },
        "updated": {
            "$t": "2013-11-08T01:23:09.295-08:00"
        },
        "category": [
            {
                "scheme": "http://schemas.google.com/g/2005#kind",
                "term": "http://gdata.youtube.com/schemas/2007#video"
            }
        ],
        "title": {
            "$t": "New Subscription Videos for Mauro Vicentini"
        },
        "logo": {
            "$t": "http://www.gstatic.com/youtube/img/logo.png"
        },
        "link": [
            {
                "rel": "alternate",
                "type": "text/html",
                "href": "https://www.youtube.com/subscription_center"
            },
            {
                "rel": "http://schemas.google.com/g/2005#feed",
                "type": "application/atom+xml",
                "href": "https://gdata.youtube.com/feeds/api/users/ysWGKld9kilWfiqcfr1pfQ/newsubscriptionvideos"
            },
            {
                "rel": "http://schemas.google.com/g/2005#batch",
                "type": "application/atom+xml",
                "href": "https://gdata.youtube.com/feeds/api/users/ysWGKld9kilWfiqcfr1pfQ/newsubscriptionvideos/batch"
            },
            {
                "rel": "self",
                "type": "application/atom+xml",
                "href": "https://gdata.youtube.com/feeds/api/users/ysWGKld9kilWfiqcfr1pfQ/newsubscriptionvideos?alt=json&start-index=1&max-results=25"
            },
            {
                "rel": "service",
                "type": "application/atomsvc+xml",
                "href": "https://gdata.youtube.com/feeds/api/users/ysWGKld9kilWfiqcfr1pfQ/newsubscriptionvideos?alt=atom-service"
            }
        ],
        "author": [
            {
                "name": {
                    "$t": "YouTube"
                },
                "uri": {
                    "$t": "http://www.youtube.com/"
                }
            }
        ],
        "generator": {
            "$t": "YouTube data API",
            "version": "2.1",
            "uri": "http://gdata.youtube.com"
        },
        "openSearch$totalResults": {
            "$t": 0
        },
        "openSearch$startIndex": {
            "$t": 1
        },
        "openSearch$itemsPerPage": {
            "$t": 25
        }
    }
}

实际上没有任何“视频”供稿。

我哪里错了?

【问题讨论】:

  • 预期的输出是什么
  • 包含视频列表的提要。我的意思是:我可以在 /my_subscriptions 上看到的视频在哪里?
  • 甚至因为应该存储在此提要中的信息是什么? :O
  • 注: http://gdata.youtube.com/feeds/base/users/default/newsubscriptionvideos?v=2&alt=json返回相同的json
  • 嗯?不,这会返回订阅。我需要返回订阅频道的视频源。 IE。这有效gdata.youtube.com/feeds/api/users/GoogleDevelopers/…。我不知道为什么它不适用于我的帐户

标签: youtube-api


【解决方案1】:

可能是这样的

https://gdata.youtube.com/feeds/api/users/[userID]/subscriptions?v=2&alt=json 或者 https://gdata.youtube.com/feeds/api/users/[userID]/newsubscriptionvideos?v=2&alt=json

不要忘记添加您可以在其中找到的 youtube 用户 ID

https://www.youtube.com/account_advanced

现在,如果您想显示其他人的订阅,但您不知道他们的用户 ID,您可能已经使用 OATH 2.0 进行了身份验证

或者直接选择

https://gdata.youtube.com/feeds/api/users/[youtube_username]/newsubscriptionvideos?v=2&alt=json

【讨论】:

    猜你喜欢
    • 2015-08-19
    • 2013-08-18
    • 2019-08-16
    • 2013-06-25
    • 1970-01-01
    • 2013-07-02
    • 1970-01-01
    • 2019-11-27
    • 1970-01-01
    相关资源
    最近更新 更多