Skip to content

Instantly share code, notes, and snippets.

@morygonzalez
Forked from hagiyaki/asahibyun.rb
Last active Aug 29, 2015
Embed
What would you like to do?
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