How do I combine multiple rest queries using YQL?

2019-02-15 07:17发布

For example I would like to combine multiple queries rest queries together. Right now I do the following code with different URLs one at a time. I think it would be faster to ultimately make one request for 10 links in my case. Any help is appreciated.

use 'http://javarants.com/yql/javascript.xml'as j; select * from j where code='response.object = y.rest("http://feedproxy.google.com/~r/Techcrunch/~3/P%5FqWQXyAPU/").followRedirects(false).get().headers.location;'

1条回答
倾城 Initia
2楼-- · 2019-02-15 08:11

One possibility would be to build your own YQL table for this, which then executes the javascript you need in an <execute>...</execute> block.

The other alternative that comes to mind is the query.multi YQL table.

Not sure that does what you want it do to but you can give it a try. Don't change the trailing quotation mark ("), it needs to stay directly after the last semicolon (this was a mistake that I just struggled with for some minutes).

USE 'http://javarants.com/yql/javascript.xml' AS j; 

SELECT * FROM query.multi WHERE queries="
select * from j where code='response.object = y.rest(\\'http://feedproxy.google.com/~r/Techcrunch/~3/P%5FqWQXyAPU/\\').followRedirects(false).get().headers';
select * from j where code='response.object = y.rest(\\'http://stackoverflow.com/feeds/question/4917144\\').followRedirects(false).get().headers';"
查看更多
登录 后发表回答