IT戦記 このページをアンテナに追加 RSSフィード Twitter

2008-08-08

フィードをオートディスカバリーする XPath

こんな感じ

document.evaluate('/html/head/link[contains(concat(" ", @rel, " "), " alternate ") and (@type = "application/x.atom+xml" or @type = "application/atom+xml" or @type = "application/xml" or @type = "text/xml" or @type = "application/rss+xml" or @type = "application/rdf+xml")]', document, null, 7, null)

ブックマークレットにしてみる

javascript:var ___r=document.evaluate('/html/head/link[contains(concat(" ", @rel, " "), " alternate ") and (@type = "application/x.atom+xml" or @type = "application/atom+xml" or @type = "application/xml" or @type = "text/xml" or @type = "application/rss+xml" or @type = "application/rdf+xml")]',document,null,7,null);for(var ___t=[],___i=0;___i<___r.snapshotLength;___i++)___t.push(___r.snapshotItem(___i).href);alert(___t.join('\n'));

でも、この辺あまり詳しくないんです><

あまり、自身ないっす

ZIGOROuZIGOROu 2008/08/08 14:04 つhttp://search.cpan.org/~btrott/Feed-Find-0.06/lib/Feed/Find.pm

amachangamachang 2008/08/08 14:05 thx!!!!

os0xos0x 2008/08/08 14:16 relはスペース区切りで複数の値を指定できる
typeはapplication/xml,application/rdf+xml,application/rss+xmlとかがあるっぽい(すみません、自信ないです)

というわけで、
//link[contains(concat(” ”, @rel, ” ”), ” alternate ”) and starts-with(@type,”application/”) and contains(@type,”xml”)]
こんなのでどうでしょうか。

あと、誤爆覚悟で //a[contains(@*,”rss”)] とかで探してみるのも有りかもしれませんね。

os0xos0x 2008/08/08 14:17 あ、更新されてた! すみません。。

amachangamachang 2008/08/08 14:23 あ。こちらこそ><。
ちょうど Perl のソース見て気がつきました!
ありがとうございます!

はてなユーザーのみコメントできます。はてなへログインもしくは新規登録をおこなってください。