-
-
Save morygonzalez/2d1e525c949e5d2916d5 to your computer and use it in GitHub Desktop.
httpclient なし、要 nokogiri
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 -*- | |
# 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