YouTube Audio Skill - testing and feedback

@j1nx, I did some playing around in my spare time and managed to get some youtube casted to my chromecast. It looks like the discovery portion of pychromecast, pychromecast.get_chromecasts() does not work on systems with more than one network interface as it uses the wrong interface to find the devices?? not sure if this is the mycroft issue or not.

I did have success casting a search with this code here.

Yes, you’re right. I think sometimes one of the audio streams might be something that mpg123 could play codec-wise, but from my initial experiments it seemed like vlc was consistently able to cope with the stream URLs pafy / youtube-dl return.

I’d be happy to include an option to use something other than the “best” audio stream, and/or use mpg123 if an appropriate stream is returned… but it looked to me like this might sometimes mean none of the streams returned would be playable for a given search result.

@mcdruid I discovered that if you ask to play something on youtube and there is no audio only streams available, it actually plays a video one.

This should not be a problem, however probably not intentional, so perhaps you need to catch the best-stream == 0 and report back to the user.

(My VLC is configured without screen support, so playing one of those streams gives A LOT of errors on the mycroft-cli-client screen.

Interesting, thanks @j1nx

I mostly use picroft with no video/screen at all and haven’t noticed this.

Do you have any examples of streams / searches which come back with no audio-only streams?

I did file an issue on gitlab the other day when I stumbled across a result which seemed to do something like return null for bestaudio - perhaps that’s relevant:

Not going round to looking at the code yet, but a working test case would be good as I can’t reproduce the issue myself now.

I encountered it once and thought, will save the song. However, YouTube probably logs those things and puts the encoding in a queue of some kind because double checking the song the next day it played without video.

So hard to debug, by just asking it for songs. I believe the best way is to ask for old and / or not so popular songs. Perhaps in your native language if other than English.

Hi, first of all: thanks for sharing this great stuff!
In the default settings everything is working fine.

But is there a way to change the language? At the moment I am using mycroft with german language support, following this:

When I evoke a stream by (typing) “spiele Hendrix” (=“play Hendrix”) mycroft says “eine sekunde bitte” (=“a second please”) but than an error is thrown out, saying “Bei der Bearbeitung ist ein Fehler im Skill Youtube Skill aufgetreten” (Roughly=“there was an error in the Skill youtube Skill”). Skill’s log says:

2019-12-17 09:52:54.439 | INFO | 8167 |
mycroft.skills.skill_loader:load:112 | ATTEMPTING TO LOAD SKILL:
2019-12-17 09:52:54.675 | INFO | 8167 |
mycroft.skills.settings:get_local_settings:78 | /opt/mycroft/skills
2019-12-17 09:52:54.710 | INFO | 8167 |
mycroft.skills.skill_loader:_communicate_load_status:270 | Skill
mycroft-youtube-audio loaded successfully
2019-12-17 09:54:19.921 | INFO | 8167 |
mycroft.skills.settings:save_settings:109 | Skill settings successfully
saved to /opt/mycroft/skills/mycroft-youtube-audio/settings.json
2019-12-17 09:54:24.072 | INFO | 8167 | Playback Control Skill |
Playing with: mycroft-youtube-audio
File “/opt/mycroft/skills/mycroft-youtube-audio/”, line 67,
in CPS_start
File “/opt/mycroft/skills/mycroft-youtube-audio/”, line 91,
in search_youtube

Also there was a regex error, so I’ve added de-de in locale; so this message is gone.

As I am totally new to mycroft my understanding of how things work is very few. It would be great if someone could point me to the place where this error-message comes from. Is it from the skill or from mycroft itself? Does anyone know if I could try some translations somewhere?

Hi there @t_ho, and welcome!

Skills need to be translated into each language before they can be used. You can see the translated skills into German here:

As you can see, this skill is not even on the list because still is so new. So, the best should be waiting for a proper translation, but you can contribute it in your own language directly with the developer, translating yourself the vocabulary files like those

Thank you malevolent for your reply.
I set up a locale “de-de” folder locally and would be glad to share it. But as I am not aware of how translating a skill actually works, I would keep checking/understanding for a while first… If someone could hint me with files would need a translation, I could to that…

Well, translation is a priori quite straight forward.

You need to create all the files inside the folders dialog and vocab or locale just like “en-us” does. That’s the easy part. Now, depending on the skill, the author has used more or less regular expressions. Let’s take an example:

You will create a directory de-de on locale folder, and inside the de-de folder, you need to create the file on_youtube.regex which content is
\s*(on|with|using) (youtube|you tube)\s*

I’m not an regex expert, but here you should translate just (on|with|using) into german and you will be ok. If you know nothing about regex, the character | (vertical bar, pipe, or) means it need to search one of these terms, so you can use any combination of “on”, “with”, and “using” with “youtube” or “you tube”, but both elements are needed (the to parenthesis groups).

My advice, copy all the english files into the german directories, and translate just the english words into your language, leaving all the symbols untouched.

Here you have a two useful links which can help you understand regex a little better.

Thanx, the link looks interesting… As my coding skills are very few, I avoided thinking about regex too much… but now it seems time : )

And, well, I was (intuitively) setting up de-de as you described it right after installing the skill, using the equivalent german terms, but there must be somewhere more than that. 'Cause the initial term “play” does not show up in the en-us file, but using the german term “spiele” (=“play”), the skill is evoked, but the errors described above occur. So the skill starts, but than fails at some point…

@t_ho the youtube-skill utilizes the CommonPlay framework, so the play/stop/pause intents are handled indirectly by the playback control skill

Hi there.
Thanks for cool skill!

Installed on Picroft (clean flash) on Raspberry Pi 3 b+ (3.5 jack audio out, usb mic in)
note for those who (same as me) got silence instead youtube stream:
Seems pulseaudio have some troubles with config, so you need just do:

  1. pactl set-default-sink alsa_output.platform-soc_audio.analog-mono (use tabs to find exact name in your case, in case it says no such device)
  2. pactl set-sink-volume @DEFAULT_SINK@ +100% - to set non zero value.

Sorry if duplicating info from middle of thread but I spend hour to finding this.


Hi @mcdruid

This skill is absolutely fantastic - thanks!
Just reporting a bug - the skill crashes if the first result is a live stream.

Example: Hey Mycroft, play relaxing jazz.
First Result on Youtube:

CLI Output:

Traceback (most recent call last):
File “/home/pi/mycroft-core/mycroft/skills/mycroft_skill/”, line 66, in wrapper
File “/home/pi/mycroft-core/mycroft/skills/”, line 153, in __handle_play_start
self.CPS_start(phrase, data)
File “/opt/mycroft/skills/mycroft-youtube-audio.mcdruid/”, line 67, in CPS_start
File “/opt/mycroft/skills/mycroft-youtube-audio.mcdruid/”, line 85, in search_youtube
self.stream_url = self.get_stream_url(self.vid_url)
File “/opt/mycroft/skills/mycroft-youtube-audio.mcdruid/”, line 108, in get_stream_url
return bestaudio.url
AttributeError: ‘NoneType’ object has no attribute ‘url’


Any way to get it to play video files every time… sometimes it plays the video file, but 95% it plays audio only

I use kde neon and vlc

Thanks for amazing skill :slight_smile:

This skill uses the Pafy library to get the best audio URL. Have a look at line 101;

def get_stream_url(self, youtube_url):
        abs_url = base_url + youtube_url
        LOG.debug('pafy processing: ' + abs_url)
        streams =
        LOG.debug('audiostreams found: ' + str(streams.audiostreams));
        bestaudio = streams.getbestaudio()
        LOG.debug('audiostream selected: ' + str(bestaudio));
        return bestaudio.url

Perhaps you can change it to this (untested) to always return the best video url instead of the best audio url, which if not found returns the video url (that 5%)

def get_stream_url(self, youtube_url):
        abs_url = base_url + youtube_url
        LOG.debug('pafy processing: ' + abs_url)
        streams =
        LOG.debug('videostreams found: ' + str(streams.videostreams));
        bestvideo = streams.getbestvideo()
        LOG.debug('videostream selected: ' + str(bestvideo));
        return bestvideo.url

Give it a test run and let us know :slight_smile:

the video starts, but there is no sound… and if I close the video the skill crash’es

1 Like

Right! Then we have to wait for the dev. Was just shooting from the hip. Perhaps AIX his skill might give some pointers as it is a GUI skil.

I’ve just installed again mark1 and the skills seems no longer working. Am I wrong and I need to do something special?
I try to install manually VLC and requirements.txt with pip3, but no luck either. I’m afraid the skill doesn’t work with debian jessie, as it cannot install neither vlc-bin nor vlc-plugin-base and installing full vlc doesn’t do the trick

Hi guys,
i am new to mycroft and trying to learn and understand stuff :wink:

I installed the skill through ssh, and it’s telling me it’s installed. But whenever i tell mycroft to play smth on YouTube, it would tell me what it doesn’t know what to do.
Did I miss anything?
I would appreciate a hint.

I am on the latest mycroft stable on a RPi 4 + ReSpeaker Mic Array v2

I ran into an error while trying to use the skill, it had worked correctly before hand. I believe this is due to the fact that search result returns live now videos.


Also the “play song/artist” function conflicts with Mycroft’s own NPR news skill and starts playing foreign news. Would it be better to use Youtube as the verb? “Hey mycroft, youtube Led Zeppelin”