GithubHelp home page GithubHelp logo

alexa-youtube's Introduction

alexa-youtube

Unofficial YouTube skill for Alexa

Last update: 22 Nov 2021

Sponsorship

  • First things first, I am asking for $3/month to use this skill. You can test it for free, but it will only ever play Gangnam Style.
  • You can donate through https://www.patreon.com/alexayoutube, or by clicking the Sponsor button at the top of this page. For just $3/month, I will give you a unique ARN which you can use to run this skill.
  • Email me at [email protected] to receive your ARN. Let me know what country you are in, and I will make sure the server is close to you, which makes it respond slightly faster.

Features

  • Play audio from YouTube videos
  • Play video (if supported) on live videos or if you ask for just one specific video (command 8)
  • Makes a list of all the videos played, in the Alexa app

Launching

  • In English, say "Alexa, launch YouTube".
  • In German, say "Alexa, öffne YouTube".
  • In Italian, say "Alexa, apri YouTube".
  • In Spanish, say "Alexa, abrir YouTube".
  • In French, say "Alexa, ouvre YouTube".

Skill Commands

  1. Play a video, eg "Alexa, ask YouTube to play Gangnam Style"
  2. Play a playlist, eg "Alexa, ask YouTube to play playlist Ultimate Beyonce"
  3. Play a channel, eg "Alexa, ask YouTube to play channel Fall Out Boy Vevo"
  4. You can replace "play" with "shuffle" to get a randomized version of the search results/channel/playlist, eg "Alexa, ask YouTube to shuffle channel Nicki Minaj"
  5. Next / Previous / Start Over / Pause / Resume should all work
  6. Ask what is playing by "Alexa, ask YouTube what song is playing" (or just "Alexa, can you repeat that?" should tell you)
  7. Skip forward or back in the video by "Alexa, ask YouTube to skip forward/backward to/by one minute and one second"
  8. Just play one video by "Alexa, ask YouTube to play one video Gangnam Style". You can switch in and out of "autoplay" mode by "Alexa, ask YouTube to turn on/off autoplay."
  9. Find the current time in the video by "Alexa, ask YouTube what is the timestamp?"
  10. If you want to play your own playlists, and the search feature finds other people's, send me a link to your youtube page.
  11. Play related videos, by "Alexa, ask YouTube to play more like this". This is a YouTube feature, don't ask me why it plays what it plays.

Command 7 doesn't seem to work on Generation 1 Echo's, no idea why. Commands 8, 9, 10 and 11 are only available in English at the moment. Need them in your language? Drop me an email and we can figure out the translation.

Known issues

  1. Some videos just fail, it's not clear why, they just do. The skill just moves to the next video on the playlist, but this can mean sometimes she announces a video that doesn't play.
  2. It appears this skill only works on Amazon Echo products, not on 3rd party products that support Alexa. If you get it to work on another device, please let me know.
  3. Live videos work on Gen 2 devices onwards, not on the original Gen 1 Echo.

Setup Instructions

  1. Go to the Alexa Console (https://developer.amazon.com/alexa/console/ask)
  2. If you have not registered as an Amazon Developer then you will need to do so. Fill in your details and ensure you answer "NO" for "Do you plan to monetize apps by charging for apps or selling in-app items" and "Do you plan to monetize apps by displaying ads from the Amazon Mobile Ad Network or Mobile Associates?"
  3. Once you are logged into your account click "Create Skill" on the right hand side.
  4. Give your skill any name, eg "My YouTube Skill".
  5. Set the "Primary Locale" to whatever language your Echo device is set to. (If you are not sure, go to the Alexa app, go to Settings, Device Settings, then click on your Echo device, and look under Language.) Turn on "Sync Locales".
  6. Choose "Custom" as your model, and "Provision Your Own" as your method, then click "Create Skill". On the template page, choose "Start from scratch".
  7. On the left hand side, click the arrow next to "Interaction Model", then click "JSON Editor".
  8. Delete everything in the text box, and copy in the text from here, (or French, Italian, German, Spanish, Japanese or Brazilian Portuguese.)
  9. Click "Save Model" at the top.
  10. Click "Interfaces" in the menu on the left, and enable "Audio Player" and "Video App". Click "Save Interfaces".
  11. Click "Endpoint" in the menu on the left, and select "AWS Lambda ARN". Under "Default Region", put the ARN. You can get an ARN by sponsoring me on https://www.patreon.com/alexayoutube, or by clicking the Sponsor button at the top of this page. (If you would like to test the skill before sponsoring me, put arn:aws:lambda:eu-west-1:175548706300:function:YouTubeTest - but this will only play Gangnam Style.) Click "Save Endpoints".
  12. Click "Tools" on the left, and then click "Permissions", and turn on "Lists Read" and "Lists Write".
  13. Click "Custom" in the menu on the left, then click "Invocation Name" on the right hand side.
  14. If you want to call the skill anything other than "youtube", change it here. Click "Save Model" if you change anything.
  15. Click "Build Model". This will take a minute, be patient. It should tell you if it succeeded.
  16. Important: At the top, click "Test". Where it says "Test is disabled for this skill", change the dropdown from "Off" to "Development".

Keeping a list of what you have played

This skill can make a list of the last 90 videos played, but you have to give it permissions in the Alexa app:

  1. Go to the Alexa app on your phone. In the menu, go to "Skills & Games", then "Your Skills", then scroll to the right and click on "Dev".
  2. Click on your YouTube skill. You should see a button marked "Settings", click that.
  3. Then press on "Manage Settings", and tick the boxes marked "Lists Read Access" and "Lists Write Access", and press "Save Settings".
  4. Say "Alexa, launch YouTube", that will create the list, and from then on, videos will be added to it. The list can be viewed in the Alexa app, click Lists from the main menu.

That's it!

Favorites List

If you enable list permissions as above, the skill will make a second list called "YouTube Favorites". You can use this to set shortcuts to videos you want often, or that are hard to find in search results. Look in the lists in the Alexa app, or at alexa.amazon.com, and you will see how it works. You add an item like:

That song I like | https://youtu.be/ZyhrYis509A

super awesome playlist | https://www.youtube.com/playlist?list=PL1EQjK4xc6hsirkCQq-MHfmUqGMkSgUTn

Then you can just say "Alexa, ask YouTube to play that song I like" or "Alexa, ask YouTube to play super awesome playlist", and it shoulds play whatever you have linked. The | character separates the name from the link (on mobile it can be hard to find, on Android go to the second page of symbols). If you find a video/playlist/channel that you like, and want to add it to your favorites, you can just say "Alexa, ask YouTube to add this video/playlist/channel to my favorites". It will then appear in the list, but you probably want to edit the name, as it just takes the video title. (Adding to favorites is currently only in English, email me if you want to translate.)

FAQ

  • Alexa tells me she can't find any supported video skills, what does that mean? Alexa is trying to be too clever, and not launching this skill. Start your request by saying 'Alexa, launch YouTube' and then when she says 'Welcome to YouTube', ask for the video you want.
  • She still says she can't find any video skills. Make sure to follow step 19 above, enabling Testing for Development.
  • She still says she can't find any video skills! Try using a different word to start the skill. In English, say "Alexa, launch YouTube". In German, say "Alexa, öffne YouTube". In Italian, say "Alexa, avvia YouTube". In Spanish, say "Alexa, abrir YouTube".
  • I am getting another issue, can you fix it? Hopefully, drop me an email!
  • If I try and test in the Developer Console, it says 'Unsupported Directive. AudioPlayer is currently an unsupported namespace. Check the device log for more information.' That is normal, the Developer Console doesn't play audio. You just need to enable testing through the Developer Console, then you can use the skill through your Alexa device.
  • Why don't more videos work as video? Alexa doesn't provide any ability to enqueue videos, so you only get one video, then it stops. So it only plays videos if you ask for one specific video, or if it is a live video.
  • Didn't the code used to be freely available? Yes, it did. Unfortunately people started stealing my code and taking credit for it, and asking for donations, so now the code is private.

alexa-youtube's People

Contributors

altrec avatar jamezrin avatar katshun0307 avatar mariosumd avatar matheusavi avatar ndg63276 avatar nightkall avatar rybot666 avatar theeisbaer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

alexa-youtube's Issues

Live video playback

Hey, about a week ago, live videos stopped working. Regular videos still work, but when I want to listen to 24/7 study beat livestreams (which is the only reason i use this skill) it gives me an error :( Any help?

Cannot get YouTube to open on Echo Dot; Works fine testing online

When trying to open YouTube on Alexa, it works through development testing on the Alexa Development website, but does not work through my 3rd-generation Echo Dot. I have tried switching the invocation to other commands, such as youtube player, and while everything works on the website, nothing works on my Dot. I get "I don't know that one" or the video skills error. My Dot is in English, and I can see the program in the Alexa app on my phone. I am using the default lambda instance. I am in Canada if that affects anything.

Communication error with the requested skill

Hi, I've configurated your great skill in Italian.
When I try to use it from the Test consol I receive this error:
"A communication error occours with the requested skill"

I've also tried to invoce the skyll writing "Alexa, open youtube" but, in this case, the error is:
"I've not found an active video skill that could open it. In order to manage video and video device look at the Alexa'App."

And if I ask "alexa open youtube" (without comma) the response is:
"I've not found any skill named youtube"

I've followed all the steps in the guide and I've not idea where to check again.

Thanks in advance.
Andrea

Language

Hello.
I managed to change the orders in my language, but Alexa continues to answer me in English!
My skill is well settled in my language.
Is there anything to change, somewhere, for her to answer me in my language?
Thank you.

Latest Lambda_Function.zip too large so cant do inline editing

@ndg63276 Just an fyi. Doesn't really impact me but with the latest update, it looks like the zipfile exceeds 3mb so inline editing is disabled in the Lambda Functions.
image
This does NOT impact any functionality. It all still works. Just need to add the DEVELOPER_KEY variable with your Google API key.
I haven't attempted to see if Cloud9 can be used with Lambda functions. But just making folks aware that inline editing will not be available (not that most will need it, since you've already taken care of everything). Thanks!

Stop or Pausing?

I understood that putting a pause allowed to resume a music. Alas, it interferes with commands other than this Skill.
Example: with my Echo, I start a music with this Skill. I say "STOP", Skill pauses and says "pausing". I ask Alexa to turn on my plug connected, and if I misunderstood my request, she said "pausing"! So she should tell me "I did not understand ...". As a result, we do not know if our request was poorly formulated !!!
It is impossible to end this Skill.
What should I change in the code to replace the "pause" with a "stop" that leaves the skill?
Thank you.

Setting up Lambda

When uploading the lambda_function.zip into AWS it indicates that the index.js does not exist. I don't know if this is directly impacting the Alexa skill that I've made, but when testing it I get "There was a problem with the requested skill's response". On another note when using your Lambda I don't have a problem.

Edit: After setting it to Python 2.7 and changing main.handler to lambda_function.lambda_handler it worked.

Any way to make it repeat song?

When I start using it I remember it repeat everything by default and skip to next only if you ask next. Now it skip to next by default. How to force repeat?

Help with playing to groups

Firstly let me say this skill is great.....

So can't get it to play to a multi echo group for example.

If I say ask youtube play "music" "everywhere", it takes "everywhere as being the song title, is it possible to add a new intent or something to allow this?

Expiration delay for lambda.

Hi, so first rly nice project and in python, thx, bored with nodeJS.
But I have problem with the pytube fonction, it take too long time to decipher the signature. and you have a "sorry something went wrong".
For the moment it works if I put 5s in Expiration delay, but I m looking for a faster way to do this part.

Do you have already tried other library/language ?

And there is a problem, the signature is made on lambda, so with the amazon IP, but when you launch the stream it s with your IP, so the link don't work, the final link is coded for only 1 IP.

Is there a way to make it "next" multiple times at once?

Some videos is hard to dictate, but I know if I dictate "alexa ask youtube to play %certain keyword%" and then "alexa next" 5 times it will play what I looking for.
The issue is, it take alot of time.
Is there a way to make alexa go to the fifth position on the search directly?

Default ARN uses french language by default

I recently started hearing "lecture de NAME" whenever playing a video and "en pause" when stopping/pausing using the default ARN despite the fact that it was previously using English. I see you have added a French language option, but it looks like it selects it by default.

Access your own playlist

Hello!
Do you know if it will be possible to access the playlists of his youtube account?
Thanks

SkillManifestError

Hey,

i can't save my own arn String because of the following problem:
"The trigger setting for the Lambda arn:aws:lambda:eu-west-1:XXXXXXXXXXXXXXX:function:alexaYT is invalid. Error code: SkillManifestError"

Settings in short:
I imported lambda_function.zip file
Set Runtime to Python 2.7
Added these envi. vars with the keys: "ALEXA_APPLICATION_ID" and "DEVELOPER_KEY".
Execution role: "lambda_basic_execution" with "Basic Lambda@Edge perm..."

I keep getting this error and don't know why :S
What different settings do you have on AWS?

Only plays on my iPhone Alexa App

Questions you need to answer
Please provide the following information:

  1. What are you saying to Alexa?
  2. What video are you trying to play? Please provide the youtube URL.
  3. Are you running your own lambda instance, or are you using mine? (ie What is your endpoint? Is it "arn:aws:lambda:eu-west-1:175548706300:function:YouTube"?)
  4. If you are running your own lambda instance, have you uploaded the latest lambda_function.zip file? This changes regularly to fix problems.
  5. What language are you using?

Using my own endpoint, yields different results

Hey. Got your skill working and it's great. Trying to setup my own endpoint and I got that working however, I am getting very different search results back from youtube. For example, when using your endpoint and I search for "prince", I get back "Playing Prince - Purple Rain (Official Video)". When I use my endpoint (which is using your stuff and my own google api key) I am getting very different results like : "Playing Prince Reveals His Favorite Song, Why He Doesn't Have A Cell Phone & More" or "Playing HOW THE HUMBLE MAID WON THE HEART OF THE PRINCE {ZUBBY MICHAEL} - NIGERIAN MOVIES 2018/2019". I am on the West coast so my Lamba function is setup to US East (N. Virgina). Not why the search results are different like that. Any ideas?

Japanese Translation

@katshun0307 has offered to help with a Japanese translation.

Here are the first set of translations I need. These are things you would say to Alexa. Don't change anything in {curly brackets}, that is where you would say a video title or similar.

                    "play music by {query}",
                    "play songs by {query}",
                    "play videos by {query}",
                    "search for {query}",
                    "Play {query}"
                    "play the song {query}",
                    "play the video {query}",
                    "play the track {query}",
                    "play one song {query}",
                    "play one video {query}",
                    "play one track {query}"
                    "shuffle {query}",
                    "shuffle songs by {query}",
                    "shuffle music by {query}",
                    "shuffle videos by {query}"
                    "Start playlist {query}",
                    "Listen to playlist {query}",
                    "Play playlist {query}"
                    "Shuffle playlist {query}"
                    "Start my playlist {query}",
                    "Listen to my playlist {query}",
                    "Play my playlist {query}"
                    "Next playlist"
                    "Shuffle my playlist {query}"
                    "Listen to channel {query}",
                    "Start channel {query} ",
                    "Play channel {query}"
                    "Shuffle channel {query}"
                    "Who is this",
                    "What video is playing",
                    "What song is playing",
                    "What is this",
                    "What is playing"
                    "Play more like this",
                    "Play videos like this",
                    "Play similar videos"
                    "Turn on autoplay",
                    "Turn autoplay on",
                    "Switch autoplay on",
                    "Switch on autoplay"
                    "Turn off autoplay",
                    "Turn autoplay off",
                    "Switch autoplay off",
                    "Switch off autoplay",
                    "Play this one video"
                    "How far into this video are we",
                    "What is the current timestamp",
                    "What is the time",
                    "What is the timestamp"

There will be more, but that is enough to get started.

no function - alexa says no video playback device

The skill doesn't work. alexa says eyery time - there is no video skill for playback ... :(

Questions you need to answer
Please provide the following information:

  1. What are you saying to Alexa?

starte youtube
or
starte youtube spiele ...

  1. What video are you trying to play? Please provide the youtube URL.
    e.g. https://www.youtube.com/watch?v=LsgTXKba6wI

  2. Are you running your own lambda instance, or are you using mine? (ie What is your endpoint? Is it "arn:aws:lambda:eu-west-1:175548706300:function:YouTube"?)

using your lambda instance

  1. If you are running your own lambda instance, have you uploaded the latest lambda_function.zip file? This changes regularly to fix problems.
  2. What language are you using?

german

Tuto with our own Lambda

I used various tutorials to use your code with my own Lambda, but it does not work. Would it be possible to have a quick tutorial with the configuration of a Lambda with your code?
Thanks

Issue Not all videos playing

Issue with a lot of youtube videos failing to play and automatically skipping to the next track.

Fixed by updating the pytube dependency to the latest version. 9.2.3

Spanish/German Translations

If anyone can translate English to Spanish for me, that would be great. Currently we have French and Italian.

First you would need to translate part of this file:
https://raw.githubusercontent.com/ndg63276/alexa-youtube/master/InteractionModel_en.json
Anything that is in a "samples" section needs translating, apart from anything in {curly brackets}.

Then you would need to go to this file:
https://raw.githubusercontent.com/ndg63276/alexa-youtube/master/lambda_function.py
and translate all the sentences in the section that says "strings_en = { ... }"

Could not find any enabled video skills

Hi Guys,

Thank you for the YouTube skill.
When I try it out on my device I get a response along the lines of "Could not find any enabled video skills to play that?", I am most probably just doing something wrong.

Anyone else experience this?

Thanks

Details:
I am trying this on the new generation Echo Dot.
My command is "Alexa, ask youtube to play summer of 69"

works on mobile,PC and reverb but not on echo dot.

hello and sorry for the dummy question!I tried everything you are describing.It works perfectly when I try from my PC,or from my mobile,or through reverb.ai but it won't work through Amazon echo dot gen2.any ideas??thanks in advance!!

Help me with guide on how to get most of it

So far it really improve my alexa user expirience but I want more. Is there any more detailed guide somewhere?

I guess it just play first result under the search request. And if I say "next" it goes to the next result? Is there an ability to remember where I stop listening for multiple videos?

AudioPlayer is currently an unsupported namespace

Hi all,

Just a quick question, is anyone else experience the following error when trying to test the youtube skill from the browser: "AudioPlayer is currently an unsupported namespace"

It seems to be just an emulator problem but I though let me just check with you as well. (See [https://stackoverflow.com/questions/49764431/error-while-playing-audio-file-for-alexa-audioplayer-is-currently-an-unsupporte])

Cheers

Title output, but no Music

Hi all,

I'm getting the response of a query from my test environemnt but my Alexa just says the title without playing the music afterwards. When I ask directly my alexa it says: "I couldn't find any enabled video skills that can play that. Go to the Alexa App to manage your video skills and devices.".

Anyone got the same problem + a solution?

Best,
flo

No Audio Playback On SONOS speaker

Hello Everybody
after tested different skill Alexa founded on github I can say that no one works well. I mean that all skill that use only Lambda function has the same problem: no audio playback on speaker(for exaple sonos). Everything works if it si reproduced on android smartphone but when you call alexa from speaker, alexa answer well "i m playing" but nothing happen.
With the last modification,is this problem solved?
thanks in advance
Francesco

Issues with Skipping Playlists

I'm having issues with it skipping playlists instead of going to the next song. I'm not sure if it thinks there are fewer songs in the playlist than there actually are or if it's a different type of issue. Playlist has 100+ songs.

Steps to reproduce:

I say "Alexa, ask YouTube to shuffle playlist XXXX" It plays the a few songs (at best) from the play list and then will move to the new playlist.

The same thing can happen when I say "Alexa, next" after initiating the shuffle.

I have the latest version from 6 days ago installed.

Translate to Spanish

Dear Friend,

I'm from Spain, and I speak spanish.
I think about your alexa-youtube is really nice and I used in English but now I'm interested on translate it to Spanish. But... I need you help. Because I'm not a developer.

I have seen the greeting in your lambda_function.py from line 251.

But I don't understant how I can upload your skill translated.

Please, can you help me?

Thank you very much for your help.

Best regards.

Is there any way to see history?

Sometime Alexa start playing something random but its good and I have no way to find what it is especially if it played by order alexa next. How exactly next work? Exactly like pressing next on youtube or maybe it press next in search list or next mean first video from recommended?

Cannot get YouTube to open on Echo Dot; Works fine testing online

When trying to open YouTube on Alexa, it works through development testing on the Alexa Development website, but does not work through my 3rd-generation Echo Dot. I have tried switching the invocation to other commands, such as youtube player, and while everything works on the website, nothing works on my Dot. I get "I don't know that one" or the video skills error. My Dot is in English, and I can see the program in the Alexa app on my phone. I am using the default lambda instance. I am in Canada if that affects anything.

Skill don't work

Hello, from today the skill no longer works. He always tells me:


Skill response was marked as failure
My YouTube Skill
Request Identifier: amzn1.echo-api.request.---------------------

The target Lambda application returned a failure response

Repetition in Playlist

I have a playlist with over 100 songs. It seems like it just shuffles through 10 or so. Can you make it randomly select from the full playlist or (better yet) keeps track of what songs it played already?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.