TermtterならBlogだってVideoだってPatentだって

gsearch pluginを改良して以下のGoogle検索に対応させました

なお日本語検索ができないという致命的な問題があります
(追記:2009/2/15)日本語検索に対応しました

使い方

Google Web Search

Web検索は以下のようにする

> google_web ruby または google ruby または gs ruby


起動optionとして l(lang) v(verbose) p(page_size)があって

> gs -l en -v true -p small ruby

とすると結果は以下のようになる


site指定もできる

> gs termtter site:d.hatena.ne.jp/keyesberry


.termtter/configでsiteのdefault値を予め以下のようにしておけば

 config.plugins.google.site = 'd.hatena.ne.jp/keyesberry'

--siteオプションが使える

> gs termtter --site

もちろんTermtterのaliasを使ってサイト指定してもいい

 config.plugins.alias.aliases = {
    :amazon => 'gs site:www.amazon.co.jp',
    :wiki      => 'gs site:ja.wikipedia.org'
 }

こうしておけばAmazonコマンドでAmazonの書籍検索が
wikiコマンドでwikipediaの検索ができるようになる


結果のリストはuri-open pluginで開くことができるが
以下に添付のdefault_replace pluginを使えば

> 3

と番号を指定して開いたり

> some 5

として0〜4を一度に開くことができる

Google Blog Search

Blog検索は以下のようにする

> google_blog google buzz または gb google buzz


起動optionはWebと同じ

> gb -l ch -v true -p small google buzz
Google Book Search

Book検索は以下のようにする

> google_book ruby または gbk ruby


起動optionは lとp

> gbk -l en -p small ruby

Google Image Search

Image検索は以下のようにする

> google_image flower または gi flower


起動optionは -lvpに加えて c(color) t(image_type) f(file_type) s(image_size)がある

> gi flower -c blue -t clipart -f gif -s large


選択肢は以下のとおり

  # :image_size = :icon, :small, :medium, :large, :xlarge, :xxlarge, :huge
  # :image_type = :face, :photo, :clipart, :lineart
  # :file_type = :jpg, :png, :gif, :bmp
Google Video Search

Video検索は以下のようにする

> google_video rubyconf または gv rubyconf


起動optionは -lvp

Google News Search

News検索は以下のようにする

> google_news google buzz または gn google buzz


起動optionは -vpに加えて e(edition) t(topic) r(relative_to)がある

> gn -e us -t entertainment -r NY people


選択肢は以下のとおり

  # :news_edition = ex. :jp, :us, :uk, :fr_ca..
  # :news_topic = :headlines, :world, :business, :nation, :science,
  #               :elections, :politics, :entertainment, :sports, :health
  # :news_relative_to = ex. city, state, province, zipcode..
Google Patent Search

Patent検索は以下のようにする

> google_patent programmig multithread または gp programmig multithread


起動optionは -vpに加えて i(issued_only)がある

> gp multithread -i true
設定

検索のdefault設定は以下のようになっている

  :verbose            => false
  :colors             => ['green']
  :lang               => :ja
  :page_size          => :large
  :news_edition       => :jp
  :news_topic         => :headlines
  :patent_issued_only => false


これらdefault値は.termtter/configで変更できる

 config.plugins.google.verbose = true
 config.plugins.google.colors = ['red', 'on_blue', 'underline']
 config.plugins.google.lang = :en
        :
        :


コードはすべてTermtter licenseに準拠します


(追記:2010/2/21)aliasについての記述を追加しました


gist: 297408 - Termtter plugins- GitHub