The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.
先日 PerlでCSSセレクタ で HTML::Selector::XPath がいい感じであると思ったわけですが、CSS セレクタだけじゃなく何気に HTML::TreeBuilder::XPath とのコンボがすげーイイ!ということにいまさら気づきました。 HTML::TreeBuilder::XPath で findnodes するとツリー状に連なった HTML::Element なデータ構造が返ってくるんですが、HTML::Element は API をかなりいろいろ持ってて、これをうまく使ってやるとスクレイピングを自然な感じで書けます。 例えばはてなダイアリーの任意のページから、本文部分だけをスクレイピングしたいと思ったときにキーワードリンクが邪魔だったりするわけですが、とりあえず HTML::Selector::XPath で div.section をぶっこ抜いて取れた HT
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く