Created
July 8, 2012 04:45
-
-
Save tily/3069418 to your computer and use it in GitHub Desktop.
AV 女優の名前をラーメン屋の店名に変換する
This file contains 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 | |
require 'uri' | |
require 'mechanize' | |
INDICE = %w(あ か さ た な は ま や ら・わ) | |
URL = "http://ja.wikipedia.org/wiki/AV女優一覧_%s行" | |
mech = Mechanize.new | |
mech.user_agent_alias = "Windows IE 7" | |
kanji_list = [] | |
INDICE.each do |i| | |
puts URI.encode(URL % [i]) | |
mech.get(URI.encode(URL % [i])) | |
mech.page.search('//div[id("mw-content-text")]/h3/following-sibling::node()/li/a[1]').each do |a| | |
kanji_list += a.text.scan(/\p{Han}/) | |
end | |
end | |
20.times do | |
puts "ラーメン #{kanji_list.sample}#{kanji_list.sample}" | |
end |
This file contains 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
bash-3.2$ ruby queen_to_ramen.rb | |
http://ja.wikipedia.org/wiki/AV%E5%A5%B3%E5%84%AA%E4%B8%80%E8%A6%A7_%E3%81%82%E8%A1%8C | |
http://ja.wikipedia.org/wiki/AV%E5%A5%B3%E5%84%AA%E4%B8%80%E8%A6%A7_%E3%81%8B%E8%A1%8C | |
http://ja.wikipedia.org/wiki/AV%E5%A5%B3%E5%84%AA%E4%B8%80%E8%A6%A7_%E3%81%95%E8%A1%8C | |
http://ja.wikipedia.org/wiki/AV%E5%A5%B3%E5%84%AA%E4%B8%80%E8%A6%A7_%E3%81%9F%E8%A1%8C | |
http://ja.wikipedia.org/wiki/AV%E5%A5%B3%E5%84%AA%E4%B8%80%E8%A6%A7_%E3%81%AA%E8%A1%8C | |
http://ja.wikipedia.org/wiki/AV%E5%A5%B3%E5%84%AA%E4%B8%80%E8%A6%A7_%E3%81%AF%E8%A1%8C | |
http://ja.wikipedia.org/wiki/AV%E5%A5%B3%E5%84%AA%E4%B8%80%E8%A6%A7_%E3%81%BE%E8%A1%8C | |
http://ja.wikipedia.org/wiki/AV%E5%A5%B3%E5%84%AA%E4%B8%80%E8%A6%A7_%E3%82%84%E8%A1%8C | |
http://ja.wikipedia.org/wiki/AV%E5%A5%B3%E5%84%AA%E4%B8%80%E8%A6%A7_%E3%82%89%E3%83%BB%E3%82%8F%E8%A1%8C | |
ラーメン 秋倉 | |
ラーメン 藤安 | |
ラーメン 麻穂 | |
ラーメン 田花 | |
ラーメン 美山 | |
ラーメン 成青 | |
ラーメン 木上 | |
ラーメン 森舵 | |
ラーメン 恵艶 | |
ラーメン 美南 | |
ラーメン 奈真 | |
ラーメン 絵心 | |
ラーメン 高杏 | |
ラーメン 音愛 | |
ラーメン 渚田 | |
ラーメン 務川 | |
ラーメン 柑原 | |
ラーメン 織白 | |
ラーメン 里薫 | |
ラーメン 乃美 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment