Mycroft Community Forum

YouTube Audio Skill - testing and feedback

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 = pafy.new(abs_url)
        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 = pafy.new(abs_url)
        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.

Error: https://pastebin.com/tDbWuPAy

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”

Hi guy, awesome work, I’ve tried it yesterday It seem to be working be today I just saying that no result bad been found. It connect well to youtube, I think maybe it’s from the Soup FindAll function but can’t be sure.

Can you have a look ? :slight_smile:

1 Like

ran into same issue… skill was awesome yesterday… something tells me youtube made changes. i tried updating the youtube dl… no luck

i already posted this in another thread, but you might want to look at

there is very minimal bs4 parsing, i only extract a json_blob, everything else is a dictionary lookup, so it is faster and less likely to break

1 Like

I have been playing with your youtube_searcher and am trying to figure out your query parameters.
I am surprised by some of the results i get or don’t get.
If I search “captain marvel” i get a result.
if I search “captain marvel trailer” i don’t get any results.
if I search “official captain marvel trailer” I get results.
is there a format I should use to get the best results then search the title from the returned json to filter my searches further?

As someone who wrote a very similar skill, I think the dream is dead. It seems that the search page is now dependent on JavaScript to actually render the results into something meaningful. The content coming back from the python requests library doesn’t actually contain the search results as parsable HTML anymore, which is why there are no search results.

Edit: @JarbasAl Sorry, I saw your post, but I didn’t know you were addressing that particular problem. I’ll see if I can implement your package and get it working.

@Hexeratops see my link above…

1 Like

@pcwii in my case i get results for all those queries except “captain marvel”

ill try to debug further and update the package, PRs welcome

1 Like

@pcwii something is weird with youtube, i almost never get results for captain marvel, but maybe 1 in 10 times i do… see https://paste.ofcode.org/QgEyMnp8292uXKyJvrmUEb

Meanwhile while debugging this i added a few more things, specifically full movies, promoted videos, corrected query, and video description, new minor version is 0.1.2

Let’s move this discussion to github

Any update on search queries working? Was looking forward to trying this out once I setup my mycroft.

I think the @JarbasAl skill is working or you could try the @gnicolas31 skill here.