Skip to content

Instantly share code, notes, and snippets.

@siyo
Last active December 12, 2015 05:38
Show Gist options
  • Save siyo/4722588 to your computer and use it in GitHub Desktop.
Save siyo/4722588 to your computer and use it in GitHub Desktop.
# -*- coding: utf-8 -*-
# teiji tweet / earthquake plugin
#
# src: http://shindanmaker.com/311937
#
require 'httpclient'
Earthquake.init do
command %r|^:teiji\s*(.+)?|, :as => :teiji do |m|
url = "http://shindanmaker.com/311937"
html = HTTPClient.new.post(url, { :u => rand(Time.now.to_i), :from => ""} )
r = nil
html.body.split("\n").detect{|e| r = e.match(/>\s+?(.+)#{url}/)}
if r
txt = m[1] ? r[1].force_encoding('utf-8').gsub("出社",m[1]) : r[1]
input(txt)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment