Skip to content

Instantly share code, notes, and snippets.

@nhitze
Created June 13, 2012 15:04
Show Gist options
  • Save nhitze/2924633 to your computer and use it in GitHub Desktop.
Save nhitze/2924633 to your computer and use it in GitHub Desktop.
YQL Thingieverse Table for Categories
<?xml version="1.0" encoding="UTF-8"?>
<table xmlns="http://query.yahooapis.com/v1/schema/table.xsd">
<meta>
<author>Nils Hitze</author>
<documentationURL>http://silberkind.de/+</documentationURL>
<sampleQuery>select * from {table} where category='toys-and-games'</sampleQuery>
</meta>
<bindings>
<select itemPath="" produces="XML">
<urls>
<url>http://www.thingiverse.com/categories/{category}</url>
</urls>
<inputs>
<key id="category" type="xs:string" required="true" paramType="path" />
</inputs>
<execute>
<![CDATA[
var query = null;
var xpath = "//div[@class='things']/*";
query = y.query("select * from html where url=@url and xpath=\""+xpath+"\"", {url:request.url});
var results = query.results.results;
for (var i = 0; i < results.length; ++i) {
y.log(results[i]);
}
var json = {};
response.object = results.results;
]]>
</execute>
</select>
</bindings>
</table>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment