Search and play YouTube videos by voice. Say what you want to hear, and this ability finds it on YouTube and streams the audio through OpenHome.
- "play on YouTube"
- "YouTube"
- "play video"
- "search YouTube"
- "find on YouTube"
You need to subscribe to two free RapidAPI APIs (same API key works for both):
- YouTube Search API (by Elis) – Subscribe to the free plan
- YouTube MP3 (by ytjar) – Subscribe to the free plan
Add your credentials to main.py:
- Replace
RAPIDAPI_KEYwith your RapidAPI key - Replace
RAPIDAPI_USERNAMEwith your RapidAPI profile username (fixes 404 when streaming – find it at rapidapi.com/developer/app)
- User says a trigger phrase like "play on YouTube"
- Ability asks what they want to play
- User speaks a song or video name
- Ability searches YouTube, gets the audio URL, and streams it in music mode
- When done, asks if they want to play something else
- User can say "stop" to exit, or "pause" / "continue" during playback
User: "Play on YouTube"
AI: "What would you like to play from YouTube?"
User: "Play Bohemian Rhapsody"
AI: "Searching YouTube... Playing Bohemian Rhapsody by Queen"
[Audio streams]
AI: "Done playing. Want to play something else?"
User: "No, stop"
AI: "Okay, stopping YouTube."