Skip to content

Instantly share code, notes, and snippets.

@tobynet
Created July 27, 2012 13:32
Show Gist options
  • Save tobynet/3188078 to your computer and use it in GitHub Desktop.
Save tobynet/3188078 to your computer and use it in GitHub Desktop.
do shindan
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
#
# usage:
# shindan.rb [id] [name]
#
# example:
# $ shindan.rb 152454 お魚日
# オオオオオョヒーオギ
require 'net/http'
id = (ARGV.shift || "152454").scan(/\d+/).first
url = URI.parse("http://shindanmaker.com/") + id
name = ARGV.shift || rand(Time.now.to_i)
html = Net::HTTP.post_form(url, { :u => name })
r = nil
html.body.split("\n").detect{|e| r = e.match(/>\s+?(.+#{url})/)}
puts r[1] if r
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment