おおいしつかさ


旅行とバイクとドライブと料理と宇宙が好き。
Ubie Discoveryのプログラマ。
Share:  このエントリーをはてなブックマークに追加

I've moved to Kamome-sou which is an apartment in the Suhmsuhm city.

 サーチエンジンのリンク元の処理のところは以下のようにしてみました。

  def search_engine_check(ref_url)  
    sites = [ 
              {:name => 'google', :url => 'http://www.google'},  
              {:name => 'google blogsearch', :url => 'http://blogsearch.google'},  
              {:name => 'blogpeople', :url => 'http://bst.blogpeople'},  
              {:name => 'yahoo', :url => 'http://search.yahoo'},  
              {:name => 'yahoo blog', :url => 'http://blog-search.yahoo'},  
              {:name => 'goo blog', :url => 'http://blog.goo'},  
              {:name => 'Ask', :url => 'http://ask.jp/'},  
              {:name => 'technorati', :url => 'http://www.technorati'},  
              {:name => 'Live Search', :url => 'http://search.live'},  
              {:name => 'Matome', :url => 'http://www.matome.jp/'}  
            ]  
 
 
    engine = nil  
    sites.each do |site|  
      if ref_url.index(site[:url]) == 0  
        engine = site[:name]  
        break  
      end  
    end  
 
    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  

 瑣末な修正。今日はあまり頭が働いていない感じです。お風呂でゆっくりしよう。