在 Javascript 中使用 Yahoo 管道
我正在为 Mechanical Turk 编写一个 JavaScript 客户端,由于 Mechanical Turk 不提供 JSON API,我通过 Yahoo Pipes 传递数据以将其格式化为 JSON。我现在在阅读这个 JSON 时遇到很多困难(由于跨域不兼容)我应该如何正确读取可以由 .parseJSON() 解析的 yahoo 管道的输出)
我想强调它是一个客户端工具(使用 JavaScript),我不想使用 PHP 设置服务器来使用提要。
{"count":1,"value":{"title":"Mturk Caller","description":"Pipes Output","link":"http:\/\/pipes.yahoo.com\/pipes\/pipe.info?_id=4dc935cadabe6d6bed8821ecabd07d6d","pubDate":"Fri, 25 Feb 2011 03:16:50 -0800","generator":"http:\/\/pipes.yahoo.com\/pipes\/","callback":"","items":[{"OperationRequest":{"RequestId":"5bf099e6-20e7-46f1-bd53-87058120498e"},"GetAccountBalanceResult":{"AvailableBalance":{"Amount":"10000.000","CurrencyCode":"USD","FormattedPrice":"$10,000.00"},"Request":{"IsValid":"True"}},"description":"","title":""}]}}
我使用的管道地址是
http://pipes.yahoo.com/pipes/pipe.run?AWSAccessKeyId=1Q7SH20FYTKQQ05SCDG2&Operation=GetAccountBalance&Service=AWSMechanicalTurkRequester&Signature=wPBfRCe5tn8vlQVv0//yc4Tm/iA=&Timestamp=2011-02-25T11:16:52Z&Version=2008-08-02&_id=4dc935cadabe6d6bed8821ecabd07d6d&_render=json&callback=?
I am writing a javascript client for mechanical turk and since mechanical turk does not provide a JSON API I am passing their data through Yahoo Pipes to format it as JSON. I now have a lot of difficulty reading in this JSON (due to cross-domain incompatibilities) How should I read the output of the yahoo pipe properly that can be parsed by .parseJSON())
I'd like to emphasize that it is a client side tool (with javascript) and I do not want to set up a server with PHP to consume the feed.
{"count":1,"value":{"title":"Mturk Caller","description":"Pipes Output","link":"http:\/\/pipes.yahoo.com\/pipes\/pipe.info?_id=4dc935cadabe6d6bed8821ecabd07d6d","pubDate":"Fri, 25 Feb 2011 03:16:50 -0800","generator":"http:\/\/pipes.yahoo.com\/pipes\/","callback":"","items":[{"OperationRequest":{"RequestId":"5bf099e6-20e7-46f1-bd53-87058120498e"},"GetAccountBalanceResult":{"AvailableBalance":{"Amount":"10000.000","CurrencyCode":"USD","FormattedPrice":"$10,000.00"},"Request":{"IsValid":"True"}},"description":"","title":""}]}}
and the pipe address that I use is
http://pipes.yahoo.com/pipes/pipe.run?AWSAccessKeyId=1Q7SH20FYTKQQ05SCDG2&Operation=GetAccountBalance&Service=AWSMechanicalTurkRequester&Signature=wPBfRCe5tn8vlQVv0//yc4Tm/iA=&Timestamp=2011-02-25T11:16:52Z&Version=2008-08-02&_id=4dc935cadabe6d6bed8821ecabd07d6d&_render=json&callback=?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要
_callback
而不是普通的callback
You need
_callback
not plaincallback