[PLUGIN] YouTube for Volumio

@framboiseMusicale your welcome :stuck_out_tongue:

Thank you for this incredible work, I definitely will follow you and your work on youtube

I followed the instructions reported here within this discussion to use the project/plugins of patrickkfkhan - https://github.com/patrickkfkan/volumio-plugins with my Google Youtube Data API key/secret on volumio - 2.834. I also updated the node package of ytdl-core as explained “npm install ytdl-core@latest”.

Instructions to install the plugin are defined here : https://github.com/ch007m/home-devices/blob/master/volumio.md#step-by-step-instructions-using-forked-plugin

I can make a search on youtube using the Volumio UI but when I click to listen a video, then the following error occurs and then I cannot hear the sound.

Is it the plugin whic reports this error “Error: Video is not valid” ? How can we fix it or troubleshoot ?

Nov 07 13:37:37 volumio volumio[1193]: info: An error occurred while exploding URI: Error: Video is not valid
Nov 07 13:37:37 volumio volumio[1193]: info: Youtube -> {"kind":"youtube#video","etag":"jAFQJWPkL9lkiP7aREf4chJ2_iU","id":"L9r-NxuYszg","snippet":{"publishedAt":"2012-03-21T12:59:47Z","channelId":"UCAwtOYAYMI8oQzyPO6xFYEQ","title":"Van Halen Eruption Guitar Solo","description":"The best ever guitar solo of Van Halen  (New Haven, Connecticut)\n(Many peoples asking, what's the 'song/part' name at the begin': it's the \"316\")\nWiki: \"It was of their performance on August 27, 1986 at New Haven's Veterans Memorial Coliseum\"","thumbnails":{"default":{"url":"https://i.ytimg.com/vi/L9r-NxuYszg/default.jpg","width":120,"height":90},"medium":{"url":"https://i.ytimg.com/vi/L9r-NxuYszg/mqdefault.jpg","width":320,"height":180},"high":{"url":"https://i.ytimg.com/vi/L9r-NxuYszg/hqdefault.jpg","width":480,"height":360},"standard":{"url":"https://i.ytimg.com/vi/L9r-NxuYszg/sddefault.jpg","width":640,"height":480},"maxres":{"url":"https://i.ytimg.com/vi/L9r-NxuYszg/maxresdefault.jpg","width":1280,"height":720}},"channelTitle":"Hazardteam","tags":["Live Without A Net","Eruption","Van Halen","guitar solo","Van Halen Live","Eddie Van Halen Solo","Live Concert","Live Music","Eddie Van Halen","Sammy Hagar","Guitar Solo","best","live","HD","hd","(Live Without A Net '86)","love","yt:quality=high","yt:crop=16:9"],"categoryId":"10","liveBroadcastContent":"none","localized":{"title":"Van Halen Eruption Guitar Solo","description":"The best ever guitar solo of Van Halen  (New Haven, Connecticut)\n(Many peoples asking, what's the 'song/part' name at the begin': it's the \"316\")\nWiki: \"It was of their performance on August 27, 1986 at New Haven's Veterans Memorial Coliseum\""}},"contentDetails":{"duration":"PT13M6S","dimension":"2d","definition":"hd","caption":"true","licensedContent":false,"contentRating":{},"projection":"rectangular"}}

Another problem that I would like to report with Google Youtube - OAuth consent screen is that we cannot select anymore as user type - internal excepted if you are a GSuite user

And by consequence (I think so), that implies that we provide external URLs accessible to verify/consent to our request. This has been confirmed by an email I got from Google

Thanks for your patience while we reviewed your project.

The homepage/privacy policy URL your provided either cannot be reached, or is a test URL:

http://localhost/dabou.html
We can’t verify your project until all the URLs can be reached and are ready for production.

Please make sure your homepage and privacy policy URLs are publicly accessible, and aren’t temporary or test URLs. You can then apply for OAuth App verification again. Please reply to this email after you’ve made these changes, and we’ll continue with the verification process.

Just wan’t to say thx to all the DEV here that make this program / plugin posble. hope anyone can fine a solution to the problem :

" Error: The request cannot be completed because you have exceeded your quota. "

greats !

on RPI 4B 8GB + LCD

that is exactly what i am facing

@dvo this is the problem i have reported in How to create youtube client ID

I was able using a different account which is a Google suite user to create an api key and define an internal application where no verification takes place

I can make a search, click on the arrow icon to listen to a youtube track but still no luck to hear something

Nov 07 20:48:35 volumio volumio[1188]: info: CorePlayQueue::saveQueue
Nov 07 20:48:35 volumio volumio[1188]: info: CoreCommandRouter::volumioPushQueue
Nov 07 20:48:35 volumio volumio[1188]: info: CoreStateMachine::updateTrackBlock
Nov 07 20:48:35 volumio volumio[1188]: info: CorePlayQueue::getTrackBlock
Nov 07 20:48:35 volumio volumio[1188]: info: Added undefined
Nov 07 20:48:35 volumio volumio[1188]: info: Youtube::addVideo
Nov 07 20:48:35 volumio volumio[1188]: info: CoreCommandRouter::volumioAddQueueItems
Nov 07 20:48:35 volumio volumio[1188]: info: CoreStateMachine::addQueueItems
Nov 07 20:48:35 volumio volumio[1188]: info: CorePlayQueue::addQueueItems
Nov 07 20:48:35 volumio volumio[1188]: info: Adding Item to queue: 1VaEdKwXJhM
Nov 07 20:48:35 volumio volumio[1188]: info: Exploding uri 1VaEdKwXJhM in service youtube
Nov 07 20:48:35 volumio volumio[1188]: info: Youtube::explodeUri https://youtube.com/oembed?format=json&url=1VaEdKwXJhM
Nov 07 20:48:35 volumio volumio[1188]: info: Youtube -> {"kind":"youtube#video","etag":"LrI1trJoiI0PapV5_9sYurvYrhk","id":"YtXq-v9XoMc","snippet":{"publishedAt":"2010-08-16T22:30:23Z","channelId":"UCy8_9W_De8bb-QeBxAAe00w","title":"Van Halen - Top Of The World","description":"Song - Top Of The World\nAlbum - For Unlawful Carnal Knowledge \nYear - 1991\nArtist - Van Halen\nGuitar - Eddie Van Halen\nKeyboards - Eddie Van Halen \nDrums - Alex Van Halen\nBass - Michael Anthony\nVocals - Sammy Hagar","thumbnails":{"default":{"url":"https://i.ytimg.com/vi/YtXq-v9XoMc/default.jpg","width":120,"height":90},"medium":{"url":"https://i.ytimg.com/vi/YtXq-v9XoMc/mqdefault.jpg","width":320,"height":180},"high":{"url":"https://i.ytimg.com/vi/YtXq-v9XoMc/hqdefault.jpg","width":480,"height":360}},"channelTitle":"andrewragford89","tags":["van","halen","top","of","the","world","for","unlawful","carnal","knowledge"],"categoryId":"10","liveBroadcastContent":"none","localized":{"title":"Van Halen - Top Of The World","description":"Song - Top Of The World\nAlbum - For Unlawful Carnal Knowledge \nYear - 1991\nArtist - Van Halen\nGuitar - Eddie Van Halen\nKeyboards - Eddie Van Halen \nDrums - Alex Van Halen\nBass - Michael Anthony\nVocals - Sammy Hagar"}},"contentDetails":{"duration":"PT3M54S","dimension":"2d","definition":"sd","caption":"false","licensedContent":false,"contentRating":{},"projection":"rectangular"}}

Van Halen Eruption Guitar Solo just plays here… no errors…

did you already done this?

I updated the ytdl node package as you can within the package.json file

"dependencies": {
		"googleapis": "45.0.0",
		"iso8601-duration": "1.0.6",
		"kew": "0.7.0",
		"md5": "2.2.1",
		"node-cache": "5.0.1",
		"v-conf": "^1.4.0",
		"ytdl-core": "^4.0.3"
	}

Here is the stackrace of the error: https://gist.github.com/cmoulliard/34285b0ea23b8ca4cd9d24ff50588061#file-gistfile1-txt-L35

Where could we report such an error, create a test case to reproduce it and try to understand what could be the fix ?

For the log, you can generate it using https://volumio.github.io/docs/User_Manual/Sending_logs_for_troubleshooting.html
I didn’t follow it, but have you reinstalled node_modules after your change in package.json?

rm -Rf nodes_modules
npm install

@cmoulliard this is mine :wink:
“dependencies”: {
“cd”: “^0.3.3”,
“googleapis”: “^61.0.0”,
“inside”: “^1.0.0”,
“iso8601-duration”: “1.0.6”,
“kew”: “0.7.0”,
“md5”: “2.2.1”,
“node-cache”: “5.0.1”,
“v-conf”: “^1.4.0”,
"ytdl-core": “^3.2.0” <<<<< you have to change this to 3.2.0 and save it again
in the same folder you do the update … npm --depth 9999 update
after this you need to reboot

Where could we report such an error? …i don’t know the creator ?
create a test case to reproduce it : simple just install the plugin and update
and try to understand what could be the fix ? the fix was already here …
i tried many things and this is what worked for me and why ?
all is running on node 8.0 the “ytdl-core”: “^4.0.3” and newer on node 10.0
this is what i know about it ( my 2 cents advice )
so the plugin has to be updated

@balbuze if you read his dependencies he didn’t do what i was saying to fix it…

@dvo I dont think that we use the same youtube plugin as mine dont include the same dependencies as yours. https://github.com/patrickkfkan/volumio-plugins/blob/master/plugins/music_service/youtube/package.json#L17

I nevertheless executed what you suggested - see commands + output https://gist.github.com/cmoulliard/965e996ba3c154b5d0e30a4188e886c0
and rebooted the pi + volumio
Unfortunately we still get the error

your using YT plugin version 0.1.0 ( date 20191224 ) like mine …
you have to alter the ytdl-core from the 4.0.3 to a 3.2.0 by typing over it in the file and save it
after that you can run :
volumio@volumio:/data/plugins/music_service/youtube$ npm --depth 9999 update
after this reboot

what i still see that in your output it’s still saying 4.0.3
instead of the 3.2.0 and you had to change that …

"dependencies": {
	"googleapis": "45.0.0",
	"iso8601-duration": "1.0.6",
	"kew": "0.7.0",
	"md5": "2.2.1",
	"node-cache": "5.0.1",
	"v-conf": "^1.4.0",
	"ytdl-core": "^**4.0.3**" <<<<< here is still the wrong one..... write over it so it says **3.2.0**

Thanks for the trick @dvo but problem is still there

volumio@volumio:/data/plugins/music_service/youtube$ rm -Rf nodes_modules
volumio@volumio:/data/plugins/music_service/youtube$ npm install
npm WARN youtube@0.1.0 No repository field.

up to date in 4.119s
volumio@volumio:/data/plugins/music_service/youtube$ cat package.json
{
	"name": "youtube",
	"version": "0.1.0",
	"description": "Youtube playback and public sharing for the Volumio",
	"main": "index.js",
	"scripts": {
		"test": "echo \"Error: no test specified\" && exit 1"
	},
	"author": "Cris Pintea <cris@pintea.net>, Stefan Laesser <sla89@gmx-topmail.de> (reworked by Patrick Kan <patrickkfkan@gmail.com>)",
	"license": "MIT",
	"volumio_info": {
		"prettyName": "Youtube Playback",
		"plugin_type": "music_service",
		"icon": "fa-youtube",
		"boot_priority": 10
	},
	"dependencies": {
		"googleapis": "45.0.0",
		"iso8601-duration": "1.0.6",
		"kew": "0.7.0",
		"md5": "2.2.1",
		"node-cache": "5.0.1",
		"v-conf": "^1.4.0",
		"ytdl-core": "^3.0.2"
	}
} 

Same error reported video is not valid : http://logs.volumio.org/volumio/eM3bni6.html

btw it’s not 3.0.2 but 3.2.0

I did the same thing (change package.json), it removed the whole youtube plugin, I can’t even find it in the plugin list sigh

oke for many it worked fine … but i’m quiting playing support for all

Sorry didn’t mean to get support, I just wanted to share :wink:

that your plugin is removed is strange this didn’t happend yet …
all you need is already posted here but there are some people using youtube
and that’s mainly outdated…

hi new problem, after couple of hours i get this

info: CoreCommandRouter::executeOnPlugin: youtube , handleBrowseUri
info: handleBrowseUri: youtube
info: CoreCommandRouter::executeOnPlugin: youtube , handleBrowseUri
info: handleBrowseUri: youtube/root/playlists
error: Invalid Credentials
Error: Invalid Credentials
at Request._callback (/data/plugins/music_service/youtube/node_modules/google-auth-library/lib/transporters.js:85:15)
at Request.self.callback (/data/plugins/music_service/youtube/node_modules/request/request.js:185:22)
at emitTwo (events.js:126:13)
at Request.emit (events.js:214:7)
at Request. (/data/plugins/music_service/youtube/node_modules/request/request.js:1154:10)
at emitOne (events.js:116:13)
at Request.emit (events.js:211:7)
at IncomingMessage. (/data/plugins/music_service/youtube/node_modules/request/request.js:1076:12)
at Object.onceWrapper (events.js:313:30)
at emitNone (events.js:111:20)
at IncomingMessage.emit (events.js:208:7)
at endReadableNT (_stream_readable.js:1064:12)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
error: Failed to execute browseSource: Error: Invalid Credentials

after i only disactivate and actived the plugin it works fine again ? any fots on how to resolf this ?

greats thx for all your great work

volumio+RPI4B 8 gb