Skip to content
This repository was archived by the owner on Feb 26, 2018. It is now read-only.

Commit 7f40588

Browse files
committed
Updating to YouTube API v3, v2 has been deprecated.
1 parent b7a7934 commit 7f40588

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

www/js/objects/playlist.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ function Playlist(data)
9999
// Generate the youtube playlist URI
100100
self.generateYouTubeURI = function()
101101
{
102-
var url = "http://www.youtube.com/embed/" + self.tracks[0].getYouTubeID() + "?rel=0&showinfo=1&playlist=";
102+
var url = "https://www.youtube.com/embed/" + self.tracks[0].getYouTubeID() + "?rel=0&showinfo=1&playlist=";
103103
var skip = true;
104104
for (var i in self.tracks)
105105
{

www/js/objects/track.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ function Track(data)
8282
// Make a best effort to get the YouTube ID.
8383
self.lookupYouTubeIdentifier = function()
8484
{
85-
var url = "https://gdata.youtube.com/feeds/api/videos?alt=json&max-results=1&q=" + self.getArtist() + " " + self.getTitle();
85+
var url = "https://www.googleapis.com/youtube/v3/search?key=[YOUR_KEY_HERE]&part=snippet&type=video&maxResults=1&q=" + self.getArtist() + " " + self.getTitle();
8686
console.log(url);
8787
jQuery.ajax(
8888
{
@@ -93,17 +93,17 @@ function Track(data)
9393
success: function(data, textStatus, jqxhr)
9494
{
9595
// Hack
96-
if (typeof data.feed.entry == "undefined")
96+
if (typeof data.items == "undefined")
9797
{
9898
self.youtubeDone = true;
9999
return;
100100
}
101101

102102
// If we got some tracks back
103-
if (data.feed.entry.length > 0)
103+
if (data.items.length > 0)
104104
{
105105
// Assume first track is best match.. for now.
106-
self.youtubeID = data.feed.entry[0].id.$t.replace("http://gdata.youtube.com/feeds/api/videos/","");
106+
self.youtubeID = data.items[0].id.videoId;
107107
console.log("[track] youtube ID = " + self.youtubeID);
108108
}
109109

0 commit comments

Comments
 (0)