Skip to content

Instantly share code, notes, and snippets.

@morygonzalez
Forked from hagiyaki/asahibyun.rb
Last active August 29, 2015 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save morygonzalez/2d1e525c949e5d2916d5 to your computer and use it in GitHub Desktop.
Save morygonzalez/2d1e525c949e5d2916d5 to your computer and use it in GitHub Desktop.
httpclient なし、要 nokogiri
# -*- coding: utf-8 -*-
# superdry tweet / earthquake plugin
#
# superdry: http://shindanmaker.com/43570
#
require 'net/http'
require 'nokogiri'
Earthquake.init do
command :byunasahi do
url = "http://shindanmaker.com/43570"
res = Net::HTTP.post_form(URI.parse(url), { :u => rand(Time.now.to_i), :from => '' })
html = Nokogiri::HTML(res.body)
text = html.css("#forcopy").text.strip.force_encoding('utf-8').
gsub(/[ \s]+?#{url}/, '').
gsub(/#asahisuperdry/, '')
input(text.each_char.inject(""){|s,c| s << "=͟͟#{c}"})
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment