Yahoo Pipes - 防止节点文本转义
我正在编写一个管道来重新映射 RSS 提要中的一些节点。
最近创建了一个新的 torrent 命名空间,并在一些提供 BitTorrent 源的网站上使用。 feed 中每个项目的 torrent 节点都包含磁铁/URI,我试图将其重新映射到媒体内容的链接,这样我的 bittorrent 客户端将默认下载该内容而不是文件本身,因为我几乎可以保证它可以获得通过 DHT 进行 torrent 文件与由于正常运行时间问题而直接下载 torrent 文件不同。
我已经成功地正确地重新映射它,除了 Magnet URI 在 MagnetURI 节点中存储为 CDATA
之外。当管道处理这个问题时,它会转义特定于 uri 的字符,例如 & 符号。有没有办法强制管道按原样呈现数据而不转义它?
下面是从其中一个提要中提取的项目的示例:
<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;dn=fileofinterest" type="application/x-magnet"/>
</item>
I'm writing a pipe to remap a few nodes in an RSS feed.
Recently a new torrent namespace was created and is being used on some sites that provide bittorrent feeds. The torrent node for each item in the feed contains magnet /URI's and I'm trying to remap this to the media content's link so my bittorrent client will default to downloading that rather than the file itself since I can almost guarantee that it can get the torrent file via DHT unlike downloading the torrent file directly due to uptime issues.
I've managed to remap it properly except that the magnet uri is stored as CDATA
in the magnetURI node. When pipes processes this it is escaping uri-specific characters like the ampersand. Is there a way to force pipes to present the data as is without escaping it?
Below is an example of an item pulled from one of the feeds:
<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>
Once it runs through the pipe where everything is remapped you can see in media:content
the magnet uri has been escaped.
<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&dn=fileofinterest" type="application/x-magnet"/>
</item>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
YP 被设计为与非程序员人类可读的文本一起使用,因此转换单个
<代码>'&' '&' 是有道理的。
我唯一可以建议的是将管道通过替换模块并以这种方式交换回来。
YP were designed for use with human readable text by NON programmers so converting a single
'&' to '&'
makes sense.Only thing I can suggest is passing the pipe through a replace module and swap it back that way.