Created
May 23, 2010 10:21
-
-
Save reid/410824 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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