jakiestfu / Youtube-TV

A small, slick, library independent YouTube User/Playlist player
https://github.com/jakiestfu/Youtube-TV#demos
205 stars 125 forks source link

videos is undefined #31

Open mMoovs opened 10 years ago

mMoovs commented 10 years ago

I noticed today, that this plugin wasn't working on a page it worked yesterday. And it gives the "videos is undefined" error.

Further digging revealed that this is using the Youtube Api v2 which is deprecated and they've already taken down some of the functions (?). So this would need an update to work with Youtube api v3. Is this plugin even maintained anymore?

I tried some quick fix: from row 107 to 123 there's the endpoints function which gets the data and I replaced some of the urls to match the api v3 getters to get playlistdata but I didn't get it to work.

Changes I tried, the originals are commented out Row 108:

//base: 'http://gdata.youtube.com/',
base: 'https://developers.google.com/apis-explorer/#p/youtube/v3/',

Row 119:

//return utils.endpoints.base+'feeds/api/playlists/'+(settings.playlist)+'?v=2&alt=json&format=5&max-results=50';
return utils.endpoints.base+'youtube.playlistItems.list?part=snippet,contentDetails,status&playlistId='+(settings.playlist)+'&key=AIzaSyCzdE3rTJNED_zQmGnHDGxnIg3A4AR6Km4';

Any ideas for this?

mylittletools commented 10 years ago

I had the same issue. It appears that the format parameter is not supported anymore by google API. Just change the endpoints from lines 108-120 by removing the &format=5 part.

 endpoints: {
    base: 'http://gdata.youtube.com/',
    userInfo: function(){
        return utils.endpoints.base+'feeds/api/users/'+settings.user+'?v=2&alt=json';
    },
    userVids: function(){
        return utils.endpoints.base+'feeds/api/users/'+settings.user+'/uploads/?v=2&alt=json&max-results=50';
    },
    userPlaylists: function(){
        return utils.endpoints.base+'feeds/api/users/'+settings.user+'/playlists/?v=2&alt=json&max-results=50';
    },
    playlistVids: function(){
        return utils.endpoints.base+'feeds/api/playlists/'+(settings.playlist)+'?v=2&alt=json&max-results=50';
    }
 },

Hope this helps!

charlisteron commented 10 years ago

Hi!! I try to replace endpoints from lines 108-120, but dosnt works

some help!!! please!

mMoovs commented 10 years ago

Thanks @mylittletools , that worked, for now!

But I'd still like to know if there's going to be a update to using the Youtube Api from v2 to v3. According to this http://apiblog.youtube.com/2014/03/committing-to-youtube-data-api-v3.html the v2 is in use until April 20, 2015 and after that who knows what they're going to do to it.

"To focus on improving v3, it’s time to say goodbye to our old friend, v2. In keeping with deprecation policy, most API functionality will remain available for use until April 20, 2015, so you have more than a year to move to the new API. See the deprecation policy in the Terms of Service for more details."

charlisteron commented 10 years ago

Yes! Its works fine!

thanks guys!!