Skip to content

Instantly share code, notes, and snippets.

@siyo
Last active September 29, 2015 08:07
Show Gist options
  • Save siyo/1571242 to your computer and use it in GitHub Desktop.
Save siyo/1571242 to your computer and use it in GitHub Desktop.
BBQしてるときっぽいtweetするやつ / earthquake.gem plugin
# -*- coding: utf-8 -*-
# bbq tweet / earthquake plugin
#
# bbq: http://shindanmaker.com/168737
#
require 'httpclient'
require 'nokogiri'
Earthquake.init do
command %r|^:bbq\s*(.+)?|,:as => :bbq do |m|
url = "http://shindanmaker.com/168737"
res = HTTPClient.new.post(url, { :u => rand(Time.now.to_i), :from => ""} )
html = Nokogiri::HTML(res.body)
text = html.css("#forcopy").text.strip
input m[1] ? text.force_encoding('utf-8').gsub("バーベキュー",m[1]) : text
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment