I won't go out home today because I've been a little tired.
kaeruspoonのリンク元としていろいろな検索サイトが増えてきたので、ちょっとコードをさわりました。
def search_engine_check(ref_url)
engine = nil
engine = "google" if ref_url.index("http://www.google") == 0
engine = "google blogsearch" if ref_url.index("http://blogsearch.google") == 0
engine = "blogpeople" if ref_url.index("http://bst.blogpeople") == 0
engine = "yahoo" if ref_url.index("http://search.yahoo") == 0
engine = "yahoo blog" if ref_url.index("http://blog-search.yahoo.co.jp/") == 0
engine = "goo blog" if ref_url.index("http://blog.goo") == 0
engine = "Ask" if ref_url.index("http://ask.jp/") == 0
engine = "technorati" if ref_url.index("http://www.technorati") == 0
engine = "Live Search" if ref_url.index("http://search.live.com/") == 0
engine = "Matome" if ref_url.index("http://www.matome.jp/") == 0
if engine
url = ref_url + '&'
url.scan(/.*(MT|p|q|keyword|tag|search)(=|\/)(.+?)(&|\?)/) do |id, mark1, words, mark2|
word_array = words.split(/[ \+]+/).select{|word| word.size > 0}.uniq
ref_url = "#{engine}検索 [#{word_array.join(' ')}]"
end
end
return ref_url
end
ああ、やっぱりRubyは気持ちいいな。
ちょっと疲れがたまっている感じ。のんびり好きなことして過ごそう。