在Android上使用YouTube API搜索视频 [英] Search video with YouTube API on Android

查看:458
本文介绍了在Android上使用YouTube API搜索视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试开发一个新的应用程序,以帮助人们一起听音乐. 我注意到的一个问题是,人们需要获得他们想听的每首歌曲或视频的YouTube代码.

I'm trying to make a new application that will help people hear music together. One problem I noticed is that the people need to get the YouTube code of each song or video they want to hear.

我通过使用带有名称和歌曲代码的MySQL数据库解决了这个问题,然后用户需要做的就是找到YouTube视频并单击与我的应用程序共享,它发送链接和名称.将视频存储到数据库中,然后用户可以在其中搜索他们想要播放的歌曲.但是,我也想摆脱它.

I kind of fixed this problem by using MySQL database with names and codes of songs, then all what the user need to do is to find the YouTube video and click on share with my application, it sends the link and the name of the video to the database and then users can search there for the song they want to play. However, I want to get rid of that, too.

是否可以使用API​​在YouTube上搜索视频?

Is there some way to search for a video on YouTube with the API?

我在Google开发人员 https: //developers.google.com/youtube/v3/docs/search/list#examples 但这是行不通的.

I found this link to open source code on Google Developers https://developers.google.com/youtube/v3/docs/search/list#examples But it just doesn't work.

推荐答案

您可以使用此

https://www.googleapis.com/youtube/v3/search?part=snippet&q=eminem&type=video&key=<key>

更改参数以获取实际需要的内容,但是您需要来自 https://console的API密钥.developers.google.com/进行这项工作.

Change the parameters to get what you actually need, but you need an API key from https://console.developers.google.com/ to make this work.

这篇关于在Android上使用YouTube API搜索视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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