Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
24 lines (21 sloc) 705 Bytes
# Messing around with the YouTube API.
# youtube me <query> - Searches YouTube for the query and returns the video
# embed link.
module.exports = (robot) ->
robot.respond /(youtube|yt)( me)? (.*)/i, (msg) ->
query = msg.match[3]
orderBy: "relevance"
'max-results': 15
alt: 'json'
q: query
.get() (err, res, body) ->
videos = JSON.parse(body)
videos = videos.feed.entry
video = msg.random videos (link) ->
if link.rel is "alternate" and link.type is "text/html"
msg.send link.href
Something went wrong with that request. Please try again.