【问题标题】:How to access licensed content included in a video using the YouTube API如何使用 YouTube API 访问视频中包含的许可内容
【发布时间】:2022-12-25 09:32:33
【问题描述】:

我想访问或收集视频中包含的许可内容的 URL。

我准备了一张图片,以防我想要的东西没有正确传达

red boxed area of this picture

这是我使用的部分代码

def youtube_videos(options):
  youtube = build(API_SERVICE_NAME, API_VERSION,
    developerKey=DEVELOPERKEY)

  search_response = youtube.videos().list(
    part = 'snippet, statistics, contentDetails, status',
    id = options,
    maxResults = 1
    ).execute()
  result = []
  for i in search_response['items']:
    result.append(i)
  print(result)

能告诉我哪部分代码需要修改,或者提供参考吗?

我还准备学习如何在 API 之外工作。

我们需要您的帮助,一如既往地感谢您。

尝试了几个请求参数,包括视频,在 YouTube API 文档中搜索,但没有得到想要的结果。

【问题讨论】:

    标签: api youtube-api


    【解决方案1】:

    YouTube Data API v3 又一次没有提供基本功能。

    我建议你试试我的open-sourceYouTube operational API。事实上,通过获取https://yt.lemnoslife.com/videos?part=musics&id=VIDEO_ID,您将获得item["musics"]中视频中包含的音乐。

    The YouTube video you shared Ehoe35hTbuY 是一个很好的视频来测试我的 API 的这个功能,因为它包含 10 首音乐。使用此视频 ID,您将获得:

    {
        "kind": "youtube#videoListResponse",
        "etag": "NotImplemented",
        "items": [
            {
                "kind": "youtube#video",
                "etag": "NotImplemented",
                "id": "Ehoe35hTbuY",
                "musics": [
                    {
                        "id": "JGwWNGJdvx8",
                        "title": "Shape of You",
                        "licenses": "WMG; LatinAutor - Warner Chappell, BMG Rights Management (US), LLC, Warner Chappell, UMPG Publishing, AMRA, LatinAutorPerf, ASCAP, MINT_BMG, Spirit Music Publishing, BMI - Broadcast Music Inc., Abramus Digital, CMRRA, Sony Music Publishing, LatinAutor, LatinAutor - UMPG, AMRA BR, SOLAR Music Rights Management, UNIAO BRASILEIRA DE EDITORAS DE MUSICA - UBEM, ARESA, LatinAutor - SonyATV, and 13 Music Rights Societies"
                    },
                    {
                        "id": "nSDgHBxUbVQ",
                        "title": "Photograph",
                        "licenses": "WMG (on behalf of East West Records UK Ltd); Sony Music Publishing, CMRRA, UNIAO BRASILEIRA DE EDITORAS DE MUSICA - UBEM, LatinAutor, BMI - Broadcast Music Inc., LatinAutor - SonyATV, AMRA BR, LatinAutorPerf, Spirit Music Publishing, SOLAR Music Rights Management, and 15 Music Rights Societies"
                    },
                    ...
                ]
            }
        ]
    }
    

    我的端点也适用于包含单个音乐的视频,例如 DUT5rEU6pqM。

    其他字段artist和writers仍然是work-in-progress。

    【讨论】:

      猜你喜欢
      • 2014-04-03
      • 2015-09-20
      • 2012-06-04
      • 2019-01-11
      • 1970-01-01
      • 2017-11-04
      • 2014-02-23
      • 2012-06-13
      • 1970-01-01
      相关资源
      最近更新 更多