Yahoo! 中使用 iframe 的正则表达式管道
我正在建立一个雅虎!通过管道从 Reddit 中提取 RSS 提要,该提要链接到描述中的某些内容。我使用正则表达式来匹配 item.description
字段中锚链接的 href 属性。我使用的正则表达式是:
^.+?href="([^"]+)">\[link\].+?$
作为测试,我将替换设置为简单地说:
$1
,到目前为止,我发现整个描述字段都已替换为 URL,
然后我将以下内容放入替换字段中。至:
内容:End
但是我得到的是:
Content: no iframe support End
我已经确认这也发生在管道的输出,而不仅仅是在 Yahoo! Pipes 调试控制台中,
到目前为止,我已经尝试用 <
和 >
实体替换我的尖括号。我尝试过包裹整个内容都在 块中,但如果我通过删除尖括号来破坏 iframe 标记,则损坏的内容会出现。很好,但如果我有一个格式良好的 iframe 元素,它就会消失,留下“无 iframe 支持”文本。我在这里做错了什么吗,还是雅虎! 主动阻止我在生成的管道中使用 iframe 标记?在谷歌上粗略搜索并没有发现任何与此相关的内容。
有问题的管道在这里:
http://pipes.yahoo.com/pipes/pipe.info?_id=2ba41448cadd2347d86f377efd3d199f
I'm building a Yahoo! Pipe to pull an RSS feed from Reddit which links to some content in the description. I'm using a regex to match the href attribute of the anchor link in an item.description
field. The regex I'm using is:
^.+?href="([^"]+)">\[link\].+?$
As a test, I set the replace to simply:
$1
and I see that the entire description field has been replaced with the URL. So far, so good.
I then put the following in the replace field. The idea being to iframe the content that's linked to:
Content: <iframe src="$1">no iframe support</iframe> End
What I get out however is:
Content: no iframe support End
I've confirmed that this is also coming through in the pipe's output and not just in the Yahoo! Pipes debug console.
I've so far tried replacing my angle brackets with <
and >
entities. I've tried wrapping the entire thing in a <![CDATA[ ... ]]>
block and still, I get nothing. If I break my iframe tag by removing an angle bracket, the broken content comes through fine, but if I have a well-formed iframe element, it vanishes, leaving the "no iframe support" text. Am I doing something wrong here, or is Yahoo! actively preventing me from using iframe tags in my generated pipe? A cursory search on Google isn't turning up anything related to this.
The pipe in question is here:
http://pipes.yahoo.com/pipes/pipe.info?_id=2ba41448cadd2347d86f377efd3d199f
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
此管道常见问题解答“为什么管道会剥离
雅虎足够大,我怀疑他们是否有一周的消毒剂,但可能性很大的是,你可以通过将 iframe 嵌套在一堆其他标签中来愚弄它(我再次怀疑这是否有效)。还取决于消毒的步骤,也许在一个步骤中添加部分标签,然后在其他地方添加另一部分可能会起作用(再次,怀疑压倒了我)
不知道还有什么建议,除了得到其他东西来消耗和稍微改变你的 RSS(通过修复其他损坏的标签??) - 但这就是你开始使用管道的目的,不是吗?我不知道...祝
你好运!
This Pipes FAQ Question "Why does Pipes Strip <object> and <embed> tags... ?" shows that a certain amount of sanitization is performed, by placing content (at least certain content) into an iframe for the safety of RSS consumers - though it does not state it specifically, this probably also removes other iframes in order to avoid nesting and other work-arounds.
Yahoo is big enough I would doubt they have a week sanitizer, but an extremely long shot is that you might be able to fool it by nesting the iframe in a bunch of other tags (again I doubt this will work). Also depending upon which step does the sanitization, perhaps adding part of the tag in one step, then adding another part somewhere else might work (yet again, doubt overwhelms me)
Not sure what else to suggest, other than getting something else to consume and transform your RSS a little bit more (by fixing otherwise broken tags??) - but that's what you're using pipes for to begin with, isn't it? Idunno...
Good luck!
Pipes 对 RSS 规范有着狂热的热爱,并且该规范规定描述字段仅为纯文本。 HTML 等应该放在 content:encoded 字段中,并不是说我很幸运地得到了管道来做到这一点。
Pipes has an fanatical devotion to the RSS spec and the spec says the description field is plain text only. HTML etc is supposed to go in the content:encoded field, not that I've had much luck getting pipes to do that.