在 Javascript 中使用 Yahoo 管道

发布于 2024-10-19 08:10:24 字数 1164 浏览 2 评论 0原文

我正在为 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

风筝在阴天搁浅。 2024-10-26 08:10:24

您需要 _callback 而不是普通的 callback

You need _callback not plain callback

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文