Last active
September 29, 2015 08:07
-
-
Save siyo/1571242 to your computer and use it in GitHub Desktop.
BBQしてるときっぽいtweetするやつ / earthquake.gem plugin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- 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