amazon-archives / web-app-starter-kit-for-fire-tv

Web App Starter Kit Examples
https://amzn.github.io/web-app-starter-kit-for-fire-tv/
Other
372 stars 161 forks source link

Youtube user / channel id not working #30

Closed jamulligan13 closed 6 years ago

jamulligan13 commented 8 years ago

For the Youtube project, I setup the init.js with my dev key and user id. As a more recent channel, it is setup from Google+, so the User ID is a long string of letters. its found as youtube.com/channel/xxxxxxx using that id it does not work. If I use what it is setup as for its custom url, it pulls up to another account with the same user name but setup before Google + so it all functions

CrandellWS commented 8 years ago

find the User ID at -> https://www.youtube.com/account_advanced

CrandellWS commented 8 years ago

@jamulligan13 youtube.com/channel/xxxxxxx is not the same as the user id...

glotv commented 6 years ago

Didn't work for me either, it only works using the old user display names (e.g. 'amazonwebservices') but Youtube is now using a different format (e.g. 'UC_0ACpAdC8...')

To make it work, I used YouTube Channel ID (not YouTube User ID) found on https://www.youtube.com/account_advanced

Also had to change model-youtube-api.js line 51 to: url: "https://www.googleapis.com/youtube/v3/channels?part=snippet,id&id="+this.youtubeUser+"&key=" + this.devKey,

maryga-amazon commented 6 years ago

Yes please use Channel ID.

adammaxon commented 5 years ago

Hello, I have tried running this and I am getting this error:

model-youtube-api.js:59 Uncaught TypeError: Cannot read property 'snippet' of undefined at YouTubeAPIModel. (model-youtube-api.js:59)

I have tried changing my user ID to Chanel ID and get the same error message. I tried to change model-youtube-api.js line 51 to: url: "https://www.googleapis.com/youtube/v3/channels?part=snippet,id&id="+this.youtubeUser+"&key=" + this.devKey, like glotv did and have had no luck.

tylercubell commented 5 years ago

This is kind of a hacky solution but it fixes the issue without needing to modify model-youtube-api.js.

Add this before 'use strict'; in init.js:

var newYouTubeAPIModel = YouTubeAPIModel.toString();
newYouTubeAPIModel = newYouTubeAPIModel.replace("snippet&forUsername=", "snippet,id&id=");
delete YouTubeAPIModel;
eval(newYouTubeAPIModel);

I don't know if this is a related or separate issue but I also noticed if you have an empty playlist, there will be an error about a missing snippet IIRC.