Alexa and Youtube music videos
One day, maybe, far into the future, tech giants would work together to provide the best set of services for everyone. Or maybe we’ll have to hack together that future ourselves. Between Google banning Youtube from some Amazon devices and Amazon banning Chromecast from its store-of-everything (which should now be renamed store-of-everything-except-chromecast) there is probably no way anyone is going to provide a nice music service app for Alexa which has a playlist of popular youtube music from trending music videos.
I’m 99% sure this is against Youtube’s terms of service, but it would be an interesting workflow to try to implement. We would need to:
- Get a list of the trending videos on Youtube parsed into some sort of feed that would give titles and URLs
- Filter the videos to search for anything that has the words “Official Video”, “Official Music” or “Music Video” somewhere in the title
- Get the URLs for that filter and check it against a database of videos already processed so we don’t reprocess any old ones
- Grab the video (and extract audio?) using something like youtube-dl
- Convert / extract audio to be playable via Alexa via ffmpeg
- Store the extracted audio somewhere where we have an Internet facing https server
- Do not use S3, don’t want any account bans
- A little linux server (maybe rpi based) that has apache and some storage should do the trick
- A nice Letsencrypt certificate with a dynamic dns hostname would be needed as well
- Write a script that dynamically selects from the extracted audio files (maybe served from the audio server, maybe not)
- Implement a skill with the audioplayer interface
Finally, yell at Alexa to ask youtube to play trending music and we should actually get some music piping back at us. We could even go further and implement some functionality to ask youtube what’s playing and it would recite the title of the video back at us.