1

RSS フィードのいくつかのノードを再マップするパイプを作成しています。

最近、新しい torrent 名前空間が作成され、bittorrent フィードを提供する一部のサイトで使用されています。フィード内の各アイテムの torrent ノードにはマグネット /URI が含まれており、これをメディア コンテンツのリンクに再マップしようとしています。アップタイムの問題が原因で torrent ファイルを直接ダウンロードするのとは異なり、DHT 経由で torrent ファイルをダウンロードする必要があります。

マグネットURIがCDATAmagnetURIノードのように保存されていることを除いて、適切に再マップすることができました。パイプがこれを処理するとき、アンパサンドのような uri 固有の文字をエスケープしています。パイプがデータをエスケープせずにそのまま表示するように強制する方法はありますか?

以下は、フィードの 1 つから取得されたアイテムの例です。

<item>
    <title><![CDATA[Some torrent title]]></title>
    <link>http://www.somebittorrentsite.com/fileofinterest.torrent</link>
    <pubDate>Mon, 21 Feb 2011 00:00:00 -0000</pubDate>
    <description><![CDATA[A torrent file you'd like to download.]]></description>
    <enclosure url="http://www.somebittorrentsite.com/fileofinterest.torrent" length="123456789" type="application/x-bittorrent" />
    <guid>912554a5-dd0e-4bee-b2ed-d776e0471552</guid>
    <torrent xmlns="http://xmlns.ezrss.it/0.1/">
        <fileName><![CDATA[fileofinterest.torrent]]></fileName>
        <contentLength>123456789</contentLength>
        <infoHash>E4799FF799F9C8C26BA087C601A732DF748FDFB0</infoHash>
        <magnetURI><![CDATA[magnet:?xt=urn:btih:E4799FF799F9C8C26BA087C601A732DF748FDFB0&dn=fileofinterest]]></magnetURI>
    </torrent>
</item>

すべてが再マッピングされるパイプを通過するとmedia:content、マグネット uri で確認できますが、エスケープされています。

<item>
    <title>Some torrent title</title>
    <link>http://www.somebittorrentsite.com/fileofinterest.torrent</link>
    <description>A torrent file you'd like to download.</description>
    <guid isPermaLink="false">912554a5-dd0e-4bee-b2ed-d776e0471552</guid>
    <pubDate>Mon, 28 Feb 2011 19:44:07 -0800</pubDate>
    <media:content url="magnet:?xt=urn:btih:E4799FF799F9C8C26BA087C601A732DF748FDFB0&amp;amp;dn=fileofinterest" type="application/x-magnet"/>
</item>
4

1 に答える 1

0

YP は、NON プログラマーが人間が読めるテキストで使用するように設計されているため、単一の変換 '&' to '&amp;'は理にかなっています。

私が提案できる唯一のことは、パイプを置換モジュールに渡し、その方法で元に戻すことです。

于 2012-05-10T14:21:08.307 に答える