[PLUGIN] YouTube2

Hi Patrickkfkan,

Happy new year.
Works perfectly on v3.010.

BR
Josef

I just had to come back to give big thanks to @patrickkfkan, @dvo and everyone else involved in this project and Volumio overall. I appreciate all the effort, work and support you all give. The new Youtube plugin has become the plugin I’ve been using the most. I’m really happy with the new features of Autoplay, and customized “Front Page Sections”.

Like the comment above, having Volumio with these plugins together with snapcast for multiroom capabilities… Awesome Stuff!!!

Thank you the great Xmas present. :slight_smile:

I think I find a problem. If I play playlist from Youtube plugin, sometimes I got an error: “443 Connection refused” and then stop the playing of the other sounds.

RPI image the latest (beta): Raspberry Pi Volumio-3.015-2021-01-03-pi
Youtube plugin is the latest too.

Everything is working fine, but sometimes i got that strange error.
Am I doing something wrong?
Thank you.

Logs:

– Logs begin at Thu 2019-02-14 11:12:01 CET. –
Jan 06 14:14:47 nappali volumio[767]: info: CoreCommandRouter::volumioGetState
Jan 06 14:14:47 nappali volumio[767]: info: Listing playlists
Jan 06 14:14:47 nappali volumio[767]: info: Listing playlists
Jan 06 14:14:57 nappali volumio[767]: info: CoreCommandRouter::volumioGetState
Jan 06 14:14:59 nappali sudo[17964]: pam_unix(sudo:session): session closed for user root
Jan 06 14:15:07 nappali volumio[767]: info: CoreCommandRouter::volumioGetState
Jan 06 14:15:07 nappali volumio[767]: info: Listing playlists
Jan 06 14:15:07 nappali volumio[767]: info: Listing playlists
Jan 06 14:15:11 nappali sudo[17972]: volumio : TTY=pts/0 ; PWD=/home/volumio ; USER=root ; COMMAND=/bin/journalctf
Jan 06 14:15:11 nappali sudo[17972]: pam_unix(sudo:session): session opened for user root by volumio(uid=0)
Jan 06 14:15:16 nappali volumio[767]: info: CoreCommandRouter::volumioPlay
Jan 06 14:15:16 nappali volumio[767]: UNSET VOLATILE
Jan 06 14:15:16 nappali volumio[767]: info: CoreStateMachine::play index undefined
Jan 06 14:15:16 nappali volumio[767]: info: CoreStateMachine::setConsumeUpdateService undefined
Jan 06 14:15:16 nappali volumio[767]: info: CorePlayQueue::getTrack 11
Jan 06 14:15:16 nappali volumio[767]: info: CoreStateMachine::startPlaybackTimer
Jan 06 14:15:16 nappali volumio[767]: info: CorePlayQueue::getTrack 11
Jan 06 14:15:16 nappali volumio[767]: info: [youtube2-play] clearAddPlayTrack: youtube2/video@videoId=gmrBzlbSQxg
Jan 06 14:15:17 nappali volumio[767]: info: CoreCommandRouter::volumioGetState
Jan 06 14:15:17 nappali volumio[767]: info: CorePlayQueue::getTrack 11
Jan 06 14:15:19 nappali volumio[767]: info: CorePlayQueue::getTrack 11
Jan 06 14:15:19 nappali volumio[767]: verbose: ControllerMpd::sendMpdCommand stop
Jan 06 14:15:19 nappali volumio[767]: verbose: ControllerMpd::sendMpdCommand clear
Jan 06 14:15:19 nappali volumio[767]: info:
Jan 06 14:15:19 nappali volumio[767]: ---------------------------- MPD announces system playlist update
Jan 06 14:15:19 nappali volumio[767]: info: Ignoring MPD Status Update
Jan 06 14:15:19 nappali volumio[767]: verbose: ControllerMpd::sendMpdCommand load “https://r1---sn-qpbpu8-c0qs.goovideo.com/videoplayback?expire=1609960516&ei=5Lf1X4-tNdGEmLAP-v2D8As&ip=77.234.76.252&id=o-ADz1WR3kfCVfDyx3zdCZL19S8nJwg2uAU86xk0Rpf&itag=251&source=youtube&requiressl=yes&mh=1M&mm=31%2C29&mn=sn-qpbpu8-c0qs%2Csn-c0q7lns7&ms=au%2u&mv=m&mvi=1&pl=22&gcr=hu&initcwndbps=1630000&vprv=1&mime=audio%2Fwebm&ns=c6tBOovsv_LDoEB2YeVfLh8F&gir=yes&clen=3976&dur=239.221&lmt=1598103237093540&mt=1609938522&fvip=1&keepalive=yes&c=WEB&txp=5531432&n=6ues0JYsbRPaLRA-&sparamxpire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cgcr%2Cvprv%2Cmime%2Cns%2Cgir%2Cclen%2Cdur%2Clmt&lsparams=mh%2C2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRgIhAPmK_GQ8h5uJ-Q41WS71jbczTn7GbU63OE35DRUWkXmjAiEA-KFfNXsmb4Cq9ZytKxm6o1mZ6lWpumnKXPMgUmh0%3D&ratebypass=yes&sig=AOq0QJ8wRgIhAKQz7nAR1lEvHV8L8C1UcihTDdYw-2tDPtuYTahpQhxHAiEAwqCUJDtYDIGnkIQ0tDgQ13wX67NgyqMb3CA1yipI%3D
Jan 06 14:15:19 nappali volumio[767]: error: updateQueue error: null
Jan 06 14:15:19 nappali volumio[767]: info: ------------------------------ 3ms
Jan 06 14:15:20 nappali volumio[767]: verbose: ControllerMpd::sendMpdCommand addid “https://r1---sn-qpbpu8-c0qs.goevideo.com/videoplayback?expire=1609960516&ei=5Lf1X4-tNdGEmLAP-v2D8As&ip=77.234.76.252&id=o-ADz1WR3kfCVfDyx3zdCZL1lS8nJwg2uAU86xk0Rpf&itag=251&source=youtube&requiressl=yes&mh=1M&mm=31%2C29&mn=sn-qpbpu8-c0qs%2Csn-c0q7lns7&ms=au%du&mv=m&mvi=1&pl=22&gcr=hu&initcwndbps=1630000&vprv=1&mime=audio%2Fwebm&ns=c6tBOovsv_LDoEB2YeVfLh8F&gir=yes&clen=3076&dur=239.221&lmt=1598103237093540&mt=1609938522&fvip=1&keepalive=yes&c=WEB&txp=5531432&n=6ues0JYsbRPaLRA-&sparaexpire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cgcr%2Cvprv%2Cmime%2Cns%2Cgir%2Cclen%2Cdur%2Clmt&lsparams=mh%2%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRgIhAPmK_GQ8h5uJ-Q41WS71jbczTn7GbU63OE35DRUWkXmjAiEA-KFfNXsm34Cq9ZytKxm6o1mZ6lWpumnKXPMgUmh0%3D&ratebypass=yes&sig=AOq0QJ8wRgIhAKQz7nAR1lEvHV8L8C1UcihTDdYw-2tDPtuYTahpQhxHAiEywqCUJDtYDIGnkIQ0tDgQ13wX67NgyqMb3CA1yipI%3D
Jan 06 14:15:20 nappali volumio[767]: info:
Jan 06 14:15:20 nappali volumio[767]: ---------------------------- MPD announces system playlist update
Jan 06 14:15:20 nappali volumio[767]: info: Ignoring MPD Status Update
Jan 06 14:15:20 nappali volumio[767]: verbose: MPD COMMAND [object Object]
Jan 06 14:15:20 nappali volumio[767]: verbose: MPD COMMAND [object Object]
Jan 06 14:15:20 nappali volumio[767]: info:
Jan 06 14:15:20 nappali volumio[767]: ---------------------------- MPD announces system playlist update
Jan 06 14:15:20 nappali volumio[767]: info: Ignoring MPD Status Update
Jan 06 14:15:20 nappali volumio[767]: info: ------------------------------ 4ms
Jan 06 14:15:20 nappali volumio[767]: info: CoreStateMachine::setConsumeUpdateService mpd
Jan 06 14:15:20 nappali volumio[767]: verbose: ControllerMpd::sendMpdCommand play
Jan 06 14:15:20 nappali volumio[767]: info: ------------------------------ 4ms
Jan 06 14:15:20 nappali volumio[767]: info:
Jan 06 14:15:20 nappali volumio[767]: ---------------------------- MPD announces state update: player
Jan 06 14:15:20 nappali volumio[767]: info: ControllerMpd::getState
Jan 06 14:15:20 nappali volumio[767]: verbose: ControllerMpd::sendMpdCommand status
Jan 06 14:15:20 nappali volumio[767]: verbose: ControllerMpd::sendMpdCommand clearerror
Jan 06 14:15:20 nappali volumio[767]: verbose: ControllerMpd::parseState
Jan 06 14:15:20 nappali volumio[767]: verbose: ControllerMpd::sendMpdCommand playlistinfo
Jan 06 14:15:20 nappali volumio[767]: verbose: ControllerMpd::parseTrackInfo
Jan 06 14:15:20 nappali volumio[767]: info: ControllerMpd::pushState
Jan 06 14:15:20 nappali volumio[767]: info: CoreCommandRouter::servicePushState
Jan 06 14:15:20 nappali volumio[767]: info: CoreStateMachine::pushState
Jan 06 14:15:20 nappali volumio[767]: info: CoreCommandRouter::volumioPushState
Jan 06 14:15:20 nappali volumio[767]: info: CoreCommandRouter::executeOnPlugin: volumiodiscovery , saveDeviceInfo
Jan 06 14:15:20 nappali volumio[767]: info: CorePlayQueue::getTrack 11
Jan 06 14:15:20 nappali volumio[767]: verbose: STATE SERVICE {“status”:“stop”,“position”:0,“seek”:null,“duration”:l,“samplerate”:null,“bitdepth”:null,“channels”:null,“random”:false,“updatedb”:false,“repeat”:false,“bitrate”:null,Streaming":false,“title”:“Takagi & Ketra, Elodie, Mariah - Ciclone ft. Gipsy Kings, Nicolás Reyes, Tonino Baliardoartist”:“Takagi & Ketra”,“album”:“YouTube Video”,“uri”:“https://r1---sn-qpbpu8-c0qs.googlevideo.com/videoplayback?ire=1609960516&ei=5Lf1X4-tNdGEmLAP-v2D8As&ip=77.234.76.252&id=o-ADz1WR3kfCVfDyx3zdCZL19j1lS8nJwg2uAU86xk0Rpf&itag=&source=youtube&requiressl=yes&mh=1M&mm=31%2C29&mn=sn-qpbpu8-c0qs%2Csn-c0q7lns7&ms=au%2Crdu&mv=m&mvi=1&pl=22&gcr=hnitcwndbps=1630000&vprv=1&mime=audio%2Fwebm&ns=c6tBOovsv_LDoEB2YeVfLh8F&gir=yes&clen=3902076&dur=239.221&lmt=1598137093540&mt=1609938522&fvip=1&keepalive=yes&c=WEB&txp=5531432&n=6ues0JYsbRPaLRA-&sparams=expire%2Cei%2Cip%2Cid%2Ci%2Csource%2Crequiressl%2Cgcr%2Cvprv%2Cmime%2Cns%2Cgir%2Cclen%2Cdur%2Clmt&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2CpCinitcwndbps&lsig=AG3C_xAwRgIhAPmK_GQ8h5uJ-Q41WS71jbczTn7GbU63OE35DRUWkXmjAiEA-KFfNXsmbKU34Cq9ZytKxm6o1mZ6lWpumnKXUmh0%3D&ratebypass=yes&sig=AOq0QJ8wRgIhAKQz7nAR1lEvHV8L8C1UcihTDdYw-2tDPtuYTahpQhxHAiEA62ywqCUJDtYDIGnkIQ0tDgQ13wXgyqMb3CA1yipI%3D",“trackType”:"”}
Jan 06 14:15:20 nappali volumio[767]: verbose: CURRENT POSITION 11
Jan 06 14:15:20 nappali volumio[767]: info: CoreStateMachine::syncState stateService stop
Jan 06 14:15:20 nappali volumio[767]: info: CoreStateMachine::syncState currentStatus stop
Jan 06 14:15:20 nappali volumio[767]: info: CoreStateMachine::pushState
Jan 06 14:15:20 nappali volumio[767]: info: CoreCommandRouter::volumioPushState
Jan 06 14:15:20 nappali volumio[767]: info: CoreCommandRouter::executeOnPlugin: volumiodiscovery , saveDeviceInfo
Jan 06 14:15:20 nappali volumio[767]: info: No code
Jan 06 14:15:20 nappali volumio[767]: info: CoreStateMachine::pushState
Jan 06 14:15:20 nappali volumio[767]: info: CoreCommandRouter::volumioPushState
Jan 06 14:15:20 nappali volumio[767]: info: CoreCommandRouter::executeOnPlugin: volumiodiscovery , saveDeviceInfo
Jan 06 14:15:20 nappali volumio[767]: info: ------------------------------ 21ms
Jan 06 14:15:27 nappali volumio[767]: info: CoreCommandRouter::volumioGetState
Jan 06 14:15:27 nappali volumio[767]: info: Listing playlists
Jan 06 14:15:27 nappali volumio[767]: info: Listing playlists

Screenshot:

Hi @chipman,

  1. Does this error occur only with playlists, and are they playlists you created in Volumio (as opposed to those that you create or find on YouTube)?

  2. Does it happen randomly, or only with certain tracks? If you click on the track again (in the queue), does it play?

  3. How many items are there in the playlist?

A 443 Connection Refused error means that the YouTube server is rejecting the request. This can be difficult to diagnose because YouTube is unlikely to return more info regarding this type of error. If this is reproducible under certain conditions, then it may be easier to pinpoint the cause of the problem.

-Patrick

Dear @Patrick,

That was a Youtube playlist (Italy Top Songs 2021 - Best Italian Music 2021) what contains 60 videos.

It stopped at the 12th song (Takagi & Ketra, Elodie, Mariah…) and if I tried to restart that song I got again the 443: Connection refused error. Then I empried the queue and added that playlist again and I got that 443 error again. Bingo!

I tried to reproduce the error with other Youtube (children songs) playlists (Legismertebb óvodásdalok) with 75 videos. It play the first three songs, then stopped. I tried to start manually the 4th (Most érkeztünk ez helyre) song and I got again the 443 error.
And then I deleted the queue and added again that playlist from Youtube. And the 4th song made the error again. Second Bingo!

Maybe we got it?

PS: I tried that tests with the Youtube plugin Scraping and Youtube API config mode too with the same result.

Thanks.
chipman

I have just tried playing the 12th song from “Italy Top Songs 2021…” and 4th song from “Legismertebb…”. They play well.

I am wondering if there’s a bug in Curl on Debian Buster that somehow handled the audio URL wrongly and sent an invalid request to YouTube (which would of course reject it).

If you can, could you try using the MPD I have here ? Follow the instructions there to activate it and see if the error persists. This MPD is the one I am using on my Volumio 2.853.

I am unable to try Volumio 3.015 at the moment but I will do that when I have time.

-Patrick

Dear Patrick,

I installed a version 2.853, updated the MPD on it, and then installed the Youtube plugin, which works properly, except for the two playlists (there may be more), where it stops with the same music with the 443 Connection refused error.

If it works well for you, there may be a problem with my settings, but I tried to set the Youtube plugin to other countries, but it didn’t play the problem song anyway.

Maybe there a router or ISP side problem?
Does anyone else have such as?

Thanks.
chipman

Could you try running a curl command in SSH and see if it shows more information about the error:

$ curl -sIXGET "<Audio URL>"

Audio URL is the one which gets sent by the plugin to MPD. In the logs you’ve shown previously, this would be the value shown in bold below:


STATE SERVICE {“status”:“stop”,“position”:0,“seek”:null,“duration”:l,“samplerate”:null,“bitdepth”:null,“channels”:null,“random”:false,“updatedb”:false,“repeat”:false,“bitrate”:null,Streaming":false,“title”:“Takagi & Ketra, Elodie, Mariah - Ciclone ft. Gipsy Kings, Nicolás Reyes, Tonino Baliardoartist”:“Takagi & Ketra”,“album”:“YouTube Video”,“uri”:“https://r1---sn-qpbpu8-c0qs.googlevideo.com/videoplayback?ire=1609960516&ei=5Lf1X4-tNdGEmLAP-v2D8As&ip=77.234.76.252&id=o-ADz1WR3kfCVfDyx3zdCZL19j1lS8nJwg2uAU86xk0Rpf&itag=&source=youtube&requiressl=yes&mh=1M&mm=31%2C29&mn=sn-qpbpu8-c0qs%2Csn-c0q7lns7&ms=au%2Crdu&mv=m&mvi=1&pl=22&gcr=hnitcwndbps=1630000&vprv=1&mime=audio%2Fwebm&ns=c6tBOovsv_LDoEB2YeVfLh8F&gir=yes&clen=3902076&dur=239.221&lmt=1598137093540&mt=1609938522&fvip=1&keepalive=yes&c=WEB&txp=5531432&n=6ues0JYsbRPaLRA-&sparams=expire%2Cei%2Cip%2Cid%2Ci%2Csource%2Crequiressl%2Cgcr%2Cvprv%2Cmime%2Cns%2Cgir%2Cclen%2Cdur%2Clmt&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2CpCinitcwndbps&lsig=AG3C_xAwRgIhAPmK_GQ8h5uJ-Q41WS71jbczTn7GbU63OE35DRUWkXmjAiEA-KFfNXsmbKU34Cq9ZytKxm6o1mZ6lWpumnKXUmh0%3D&ratebypass=yes&sig=AOq0QJ8wRgIhAKQz7nAR1lEvHV8L8C1UcihTDdYw-2tDPtuYTahpQhxHAiEA62ywqCUJDtYDIGnkIQ0tDgQ13wXgyqMb3CA1yipI%3D",“trackType”:"”}

I suggest you play the problematic track in Volumio and get the up-to-date value from the logs. I would not be able to test the Audio URL obtained from your logs because it’s specific to your IP address and session.

On my side, here’s what I get:

HTTP/1.1 200 OK
Last-Modified: Thu, 08 Jun 2017 10:03:11 GMT
Content-Type: audio/webm
Date: Thu, 07 Jan 2021 11:10:01 GMT
Expires: Thu, 07 Jan 2021 11:10:01 GMT
Cache-Control: private, max-age=21187
Accept-Ranges: bytes
Content-Length: 1711889
Connection: keep-alive
Alt-Svc: h3-29=":443"; ma=2592000,h3-T051=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v=“46,43”
Vary: Origin
Cross-Origin-Resource-Policy: cross-origin
X-Content-Type-Options: nosniff
Server: gvs 1.0

Remember to put the URL in double quotes.

Absolutely nothing. :frowning:
No output.

But if I check a working URL, I got response too:

HTTP/1.1 200 OK
Last-Modified: Tue, 03 Nov 2020 13:06:50 GMT
Content-Type: audio/webm
Date: Thu, 07 Jan 2021 12:00:49 GMT
Expires: Thu, 07 Jan 2021 12:00:49 GMT
Cache-Control: private, max-age=21235
Accept-Ranges: bytes
Content-Length: 2731425
Connection: keep-alive
Alt-Svc: h3-29=":443"; ma=2592000,h3-T051=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v=“46,43”
Vary: Origin
Cross-Origin-Resource-Policy: cross-origin
X-Content-Type-Options: nosniff
Server: gvs 1.0

I also checked from my friend’s network, there was no problem.
So this will be a network issue. I will continue to investigate in this direction.

Thank you for your great support and your work!

This curl command should give you more info (hopefully):

$ curl -Iiv "<Audio URL>"

Hope you get this working in the end…

That more detailed error message helped:

  • Hostname was NOT found in DNS cache
  • Trying 0.0.0.0…
  • connect to 0.0.0.0 port 443 failed: Connection refused
  • Trying ::…
  • Immediate connect fail for ::: Cannot assign requested address
  • Failed to connect to r3---sn-qpbpu8-c0ql.googlevideo.com port 443: Connection refused
  • Closing connection 0
    curl: (7) Failed to connect to r3---sn-qpbpu8-c0ql.googlevideo.com port 443: Connection refused

The AdGuard Home block that host and drop the connections. I enabled the entire googlevideo.com domain and both playlist working well.

Thanks again for your help, Patrick!

Good to know that it’s working now!

Installed the plugin on Volumio 2.861 and updated mpd on a raspberry pi 3b. Everything is working perfectly.
Thanks @patrickkfkan!

Hi all and happy new year. :slight_smile:

I saw this new plugin yesterday night, so I tried to install following the GitHub link and creating the youtube API google user as described on the guide here : volumio-youtube2/gapi_setup.md at master · patrickkfkan/volumio-youtube2 · GitHub

But I have two problems.

  1. In scraping mode, research find anything good. Seems not to be the same research as on youtube, and I can’t fin d anything good. Only youtube channel and no titles. Weird…
  2. In google API mode -> Go to verification URL, I enter the code, but in the end I have an error message :slight_smile:

Erreur d’autorisation
Erreur 403 : access_denied
The developer hasn’t given you access to this app. It’s currently being tested and it hasn’t been verified by Google. If you think you should have access, contact the developer (xxx.xxx@gmail.com).
En savoir plus
Détails de la requête
response_type=none
client_id=26xxxxxxxxxxcontent.com
access_type=offline
scope=https://www.googleapis.com/auth/youtube.readonly

I tried to do it again on a new project on google interface, changing API key, client_id, and secret code, but still the same issue…

Any idea of what I could do wrong ?
It seemed easy to do

Thanks a lot for your time and take care.

Hi @tekalekatan,

  1. What did you search for? At least provide some examples of search terms that didn’t return any good results…

  2. Are you sure you setup the API credentials correctly? Like setting ‘scope’ to ‘readonly’?

-Patrick

Hi @patrickkfkan,

  1. Actually I didn’t scroll down enough…So, I just saw ‘Youtube Channel’ and ‘Youtube playlist’. The videos are in the third part and works nice. Is there a way to switch ‘Youtube videos’ on the top of page ? I tried in the plugin setup but nothing concluant…

  2. I don’t know, I followed the ‘tuto’ and it seems to be the same…

Also, musics seem to stop around 3/4 of time.

Try to read the topic. The 3/4 problem have been discussed above.

1 Like

@tekalekatan,

It seems that Google has changed some parts of the ‘Configure Consent Screen’ process.

In Google Developers Console, could you select ‘OAuth Consent Screen’ in the left menu? You should see this:

Under ‘Test Users’, click the ‘+ Add Users’ button. Then enter the e-mail address which you will use to access your YouTube account.

See if you can successfully enter the Code afterwards (you will get a ‘App not verified’ warning - this is normal. Just click ‘Advanced’ and ‘Proceed to…’).

For 3/4 problem, you need to update your MPD as stated in the first post of this thread. Or use Volumio 3.x beta.

Please report back if possible.

-Patrick

@patrickkfkan : I’ve just added the test user, and it works nice, I have a : “Access granted - Volumio has read-only accessto your Youtube Account” under Volumio !! :slight_smile:

I will now update MPD as described.

Thanks a lot for your help !

Thanks for confirming! I’ve updated the API credentials setup guide on the Github repo in case others may find it useful.