Skip to content

Instantly share code, notes, and snippets.

@reid
Created May 23, 2010 10:21
Show Gist options
  • Save reid/410824 to your computer and use it in GitHub Desktop.
Save reid/410824 to your computer and use it in GitHub Desktop.
<?xml version="1.0" encoding="UTF-8" ?>
<table xmlns="http://query.yahooapis.com/v1/schema/table.xsd">
<meta>
<author>Reid Burke</author>
<sampleQuery>select * from {table}</sampleQuery>
</meta>
<bindings>
<select itemPath="" produces="XML">
<urls>
<url></url>
</urls>
<inputs>
<key id="context" type="xs:string" paramType="variable" required="true"/>
<key id="api_key" type="xs:string" paramType="variable" required="true"/>
</inputs>
<execute><![CDATA[
var key = inputs.api_key;
default xml namespace = "urn:yahoo:cate";
var query = y.query("select * from search.termextract where context = \"" + inputs.context + "\"");
var results = query.results.Result;
default xml namespace = "";
var root = <etsy/>;
for each (var item in results) {
var etsy = y.query("use \"https://github.com/reid/yql-tables/raw/aaf0c73e9c8a55c590fded26a410f141fb69b8da/etsy/etsy.listings.xml\" as etsy.listings; select * from etsy.listings(3) where search_terms = \"" + item + "\" and includes = \"Images:1\" and api_key = \"" + key + "\"");
root.etsy += etsy.results.results;
}
response.object = root;
]]></execute>
</select>
</bindings>
</table>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment