Page 1 of 13

Youtube3

PostPosted: Thu May 21, 2015 3:48 am
by mad_ady
This plugin implements a youtube client using Youtube's API v3 implementation without authentication. This means you are able to search youtube (for videos, channels, subscriptions) and also browse your channel's/account public data (subscriptions, playlists, uploads, liked videos, etc). This client comes as a response to Youtube turning off their API v2 and killing the Youtube/YoutubeHD/Youtube-Subscriptions previous implementations. The implementation is not perfect and is a bit hard to navigate, but it's a working solution.

Prerequisites:
  • You need a firmware that has PHP with CURL support - currently Live/Plus firmwares 0.5.2.1 or later. The plugin will not work on older releases (you need to upgrade). It should also work on Gen3/4 (feedback welcome)
  • Python 2.7.9 app.bin for VEVO clips and New Subscription Videos: https://mega.nz/#!wcxFyTgK!IjPCwikRUFMr4i9zrU53C1dqvW-uSC47_R4epfWY9iA (download the file, and extract the app.bin to the root of your USB drive and reboot the WDTV)VEVO clips play nativelly thanks to a patch from nixxo!

Screenshots (plugin with WDTVExt UMSPExtra plugin):
Data for a channel/user:
Image
Categories:
Image
A random playlist:
Image

How to activate:
  • Navigate to Webend -> Addons Manager -> UMSP and select Youtube3 from the list to install.
  • Navigate to Webend -> Configuration Manager -> UMSP -> Youtube3 to enable and customize (e.g. you can add your account name (this isn't always the same thing as your email address, but you can find it out by going to https://www.youtube.com/user and you should be redirected to something like https://www.youtube.com/user/someyoutubeaccountname. Use this name to log in.) in YOUTUBE_USERS variable). Note: newer youtube accounts no longer have a youtube username associated with them (it's considered legacy) and this method will not work (leave YOUTUBE_USERS blank). Make sure to have UMSP and APACHE turned on.
  • If you can't find your Youtube User you can get your channel ID by going to -> https://www.youtube.com/user will redirect you to https://www.youtube.com/channel/xxxxxxxx with a "new" google account
    If you have an old account, just visit "My channel" and you'll get your id. Fill in the ID (or list of IDs) into YOUTUBE_CHANNELS variable (multiple IDs separated by comma).
  • Navigate via OSD to Video -> Media Servers -> UMSP -> Youtube3

Features:
  • Press Search on your remote to search for content (while inside the plugin). The results will contain videos, channels and playlists which you can explore
  • For your accounts you can view your public data (subscriptions, playlists, uploads). Private data can't be listed or played (the plugin doesn't authenticate the user).
  • You get 50 results per page. If you want more, use "Next page" to get more results

Todo:

Things that will not be possible with this plugin:

Why aren't you using OAuth?
OAuth mechanism is more complicated than the simpler API (obviously). It adds some restrictions on your device - it needs to be manually approved by the user via the youtube interface, it requires correct dates set and needs constant checks to see if the tokens expired or not (in order to regenerate them). I (mad_ady) am unlikely to do it, but if some other developer wants to add it in, feel free to do it.

Deprecated configuration variables (if you were using youtube-subscriptions):
YOUTUBE_VIDEOS_PER_CHANNEL
YOUTUBE_SUBSCRIPTION_SORT
YOUTUBE_PLAYLIST_SORT

Known bugs:
1. You can only get one page of subscriptions - youtube fucked up with the responses. I'm waiting for a fix on their end: https://code.google.com/p/gdata-issues/issues/detail?id=7163
2. If the search result is a channel, you can only view its subscriptions and playlists, not uploaded videos. It can be fixed with an extra query if users are interested in it...

Let's discuss problems and ideas related to youtube implementation on this thread.

Re: Youtube3

PostPosted: Sat May 23, 2015 3:26 pm
by baloco
Mad_ady,

Great you are developing this, can't believe youtube killed the v2 api.

I've installed the plugin with firmware 0.5.1.1 and when I open the channel, it returns "there is no media in the current folder"

Do you know if there is something I could do to troubleshoot this?

Thanks and best!

Re: Youtube3

PostPosted: Sun May 24, 2015 9:30 am
by johnkalamata
gh

Re: Youtube3

PostPosted: Sun May 24, 2015 10:00 am
by wildwdlxtv
I tried with my youtube login @gmail.com, but under subscriptions, it seems to bring up channels that are not mine. I have my subscriptions as public under privacy settings.

Re: Youtube3

PostPosted: Sun May 24, 2015 10:53 am
by mad_ady
@baloco - you need at least firmware 0.5.2.1 for this to work (read the prerequisites section). You can find firmware 0.5.2.2 under the firmware release subforum.
Edit: I added a more useful error message if you run the plugin on an older firmware.

@wildwdlxtv: can you PM me your youtube/gmail username and some subscriptions that are not yours? Maybe it's a different account...

Re: Youtube3

PostPosted: Mon May 25, 2015 8:52 am
by wildwdlxtv
I think I figured it out. This plugin uses the youtube username which is different from my gmail login. Using my gmail login name results in another user's subscriptions being shown. Though google now uses the gmail login for youtube authentication.

Re: Youtube3

PostPosted: Tue May 26, 2015 2:54 am
by mad_ady
Yeah, I use their API with a call with parameter "forUsername". I tried my username and it didn't work, so I stripped the dots from it and it worked... Can you tell us where inside Google/GMail/Youtube can you find your youtube username?

Re: Youtube3

PostPosted: Sat May 30, 2015 9:38 am
by Martin_L
Kudos! mad_ady you rule!
Thank you for your work.

Martin

Re: Youtube3

PostPosted: Sun May 31, 2015 11:32 am
by wildwdlxtv
https://www.youtube.com/account lists all the channels for a google account. I login with my google login @gmail.com, but my public channels are at https://www.youtube.com/user/channelname.

channelname is what I use in the Youtube3 plugin configuration and it is different from my @gmail login

Re: Youtube3

PostPosted: Mon Jun 08, 2015 1:24 am
by mad_ady
A small update:
1. It seems youtube has fixed their API with regards to subscriptions and you should now get all your subscriptions listed.
2. I started to work on getting VEVO support. It almost works, but it's slow - it will take about 30s more when starting to play a video because I need to run an external tool to get the signature (youtube-dl: https://rg3.github.io/youtube-dl/download.html). You'll also need to install python.app.bin for this tool to work. However, this doesn't work yet, because, up until now we used to get the data over HTTP. Signed videos are only available over HTTPS. I need to do a bit of rewriting to be able to get HTTPS videos to play (I'll look into curl).

For now, if you try to play a vevo video, if you enable debugging, you should see something like this in your log (/tmp/umsp-log.txt):
Code: Select all
...
2015.06.08 12:12:06 YTSubscriptions-proxy - _getYTVideo -> Using youtube-dl to get the URL of an encrypted video - assuming you have python installed...
2015.06.08 12:12:37 YTSubscriptions-proxy - _getYTVideo(youtube-dl) -> Array
(
    [0] => https://r6---sn-gqn-vu2e.googlevideo.com/videoplayback?id=c35a0cde44295d1a&itag=137&source=youtube&requiressl=yes&mn=sn-gqn-vu2e&pl=23&mm=31&mv=m&ms=au&ratebypass=yes&mime=video/mp4&gir=yes&clen=68824433&lmt=1432886438977567&dur=251.960&sver=3&fexp=936100,9405961,9407016,9407992,9408142,9408369,9408420,9408710,9412774,9413503,9415304,9415636,9415752,9415928&mt=1433754688&upn=fFIyGyx8dZw&signature=6411291E177B3E20714491FB8BC4CE6580CB3C0F.759F1A33A4814AE1A4C1863FDC43155A022C7206&key=dg_yt0&ip=82.76.238.212&ipbits=0&expire=1433776345&sparams=ip,ipbits,expire,id,itag,source,requiressl,mn,pl,mm,mv,ms,ratebypass,mime,gir,clen,lmt,dur
    [1] => https://r6---sn-gqn-vu2e.googlevideo.com/videoplayback?id=c35a0cde44295d1a&itag=141&source=youtube&requiressl=yes&mn=sn-gqn-vu2e&pl=23&mm=31&mv=m&ms=au&ratebypass=yes&mime=audio/mp4&gir=yes&clen=8035914&lmt=1432886076242167&dur=252.029&sver=3&fexp=936100,9405961,9407016,9407992,9408142,9408369,9408420,9408710,9412774,9413503,9415304,9415636,9415752,9415928&mt=1433754688&upn=fFIyGyx8dZw&signature=52070BBB371AECC106DD933DCD4D62EEF952F6AD.28E527FE7AD97CA00D6DB437DF6AD0B88839738F&key=dg_yt0&ip=82.76.238.212&ipbits=0&expire=1433776345&sparams=ip,ipbits,expire,id,itag,source,requiressl,mn,pl,mm,mv,ms,ratebypass,mime,gir,clen,lmt,dur
)
2015.06.08 12:12:37 YTSubscriptions-proxy - _getYTVideo(youtube-dl) -> Returning URL https://r6---sn-gqn-vu2e.googlevideo.com/videoplayback?id=c35a0cde44295d1a&itag=137&source=youtube&requiressl=yes&mn=sn-gqn-vu2e&pl=23&mm=31&mv=m&ms=au&ratebypass=yes&mime=video/mp4&gir=yes&clen=68824433&lmt=1432886438977567&dur=251.960&sver=3&fexp=936100,9405961,9407016,9407992,9408142,9408369,9408420,9408710,9412774,9413503,9415304,9415636,9415752,9415928&mt=1433754688&upn=fFIyGyx8dZw&signature=6411291E177B3E20714491FB8BC4CE6580CB3C0F.759F1A33A4814AE1A4C1863FDC43155A022C7206&key=dg_yt0&ip=82.76.238.212&ipbits=0&expire=1433776345&sparams=ip,ipbits,expire,id,itag,source,requiressl,mn,pl,mm,mv,ms,ratebypass,mime,gir,clen,lmt,dur
...


But later on you will see lots of 403 error messages from the server (being requested over http).

I'll let you guys know when things have changed...