在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.