2016-10-07 / syui

memo

xmllint

Web RSSからデータを取るにはxmllintなどを使えば便利ですが、使いこなすにはちょっとしたコツが必要です。

主に以下のオプション, Exampleを知れば、そこそこ使えると思います。

$ curl -sL https://syui.gitlab.io/blog/index.xml
$ curl -sL !$ | xmllint --format - >! index.xml
$ echo 'cat /rss/channel/item[0]/title' | xmllint --shell index.xml
$ xmllint --xpath '/rss/channel/item[1]/title/text()' index.xml