試す環境は MacBook Air で。 $ uname -mrsv Darwin 10.7.0 Darwin Kernel Version 10.7.0: Sat Jan 29 15:17:16 PST 2011; root:xnu-1504.9.37~1/RELEASE_I386 i386 $ ruby -v ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0] $ gem list | grep hpricot hpricot (0.8.4, 0.6.164) $ gem list | grep nokogiri nokogiri (1.4.4) サンプルコード。 Hpricot でも Nokogiri でもほぼ同じように使える。 $ cat ./ru.rb #!/usr/bin/env ruby $KCODE='
Overview Overview API Support Tutorials Changelog About Nokogiri¶ Nokogiri (鋸) makes it easy and painless to work with XML and HTML from Ruby. It provides a sensible, easy-to-understand API for reading, writing, modifying, and querying documents. It is fast and standards-compliant by relying on native parsers like libxml2, libgumbo, and xerces. Guiding Principles¶ Some guiding principles Nokogiri
■ [ruby] RubyでHTMLとWebを操作するためのライブラリ、HpricotとWWW::Mechanize 今日は、RubyでWebサイトを解析するときに強い味方となるライブラリ、HpricotとWWW::Mechanizeを紹介します。 どちらも非常に強力なので、覚えておいて損はないよ! 以下ではまずHpricotでHTMLを解析・編集する方法について解説します。 次に、「はてなダイアリーの自動更新」を例にWWW::Mechanizeの使い方を解説します。 Hpricot HpricotはHTMLを解析するためのライブラリです。 例えば「あるページのリンクだけを全部抜き出したい」と思ったとき、どうしますか?scrAPIを使う?でもscrAPIはやっぱり ちょっと使いたいだけなのにパーザ(Scrape)用のクラスを定義するのが面倒なんだよね! Hpricotなら、たったこれだけで
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く