Skip to content

Instantly share code, notes, and snippets.

@atmos
Forked from dstrelau/lolz.coffee
Created October 26, 2011 23:56
Show Gist options
  • Save atmos/1318381 to your computer and use it in GitHub Desktop.
Save atmos/1318381 to your computer and use it in GitHub Desktop.
hubot script to insert images from bukk.it
# lulz - BRING THE LOLZ from bukk.it
Select = require("soupselect").select
HtmlParser = require "htmlparser"
util = require 'util'
module.exports = (robot) ->
robot.respond /l[ou]lz/i, (msg) ->
msg.http("http://bukk.it")
.get() (err, res, body) ->
handler = new HtmlParser.DefaultHandler()
parser = new HtmlParser.Parser handler
parser.parseComplete body
results = ("http://bukk.it/#{link.attribs.href}" for link in Select handler.dom, "td a")
msg.send msg.random results
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment