使用 YouTube API 仅搜索 YouTube 上的音乐曲目

编程入门 行业动态 更新时间:2024-10-26 10:40:16
本文介绍了使用 YouTube API 仅搜索 YouTube 上的音乐曲目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想使用 YouTube API (v3) 来启用仅搜索音乐曲目(不包括猫或藤蔓或任何其他非音乐视频).我在 API Explorer 和文档中查看了有关此问题的任何指示,但找不到任何有用的信息.

I'd like to use the YouTube API (v3) to enable searches of only music tracks (no cats or vines or any other non-musical video). I looked in the API Explorer and the docs for any pointers on that matter, but could not find any helpful information.

如何只搜索音乐?是否也可以按发行年份或音乐类型过滤搜索结果?

How can I search for music only? Is it also possible to filter the search results by year of release or music genre?

推荐答案

您能做的最好的事情是在您的查询中添加一个 videoCategoryId 参数到 YouTube 数据 API.这样可以确保只返回属于该类别的视频.

The best you can do is to add a videoCategoryId parameter in your query to the YouTube Data API. This ensures that only videos belonging to this category are returned.

正如另一个 Stackoverflow 问题中提到的,在美国和其他允许音乐的地方,音乐的 videoCategoryId 是 10.

As referenced in this other Stackoverflow question, the videoCategoryId for music in the US and elsewhere where music is allowed is 10.

来源:YouTube API V3: 在哪里可以找到每个videoCategoryId"的列表?

更多推荐

使用 YouTube API 仅搜索 YouTube 上的音乐曲目

本文发布于:2023-07-11 09:28:23,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1093581.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:曲目   音乐   YouTube   API

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!