Skip to content

Instantly share code, notes, and snippets.

@youpy
Created March 21, 2009 20:17
Show Gist options
  • Save youpy/82965 to your computer and use it in GitHub Desktop.
Save youpy/82965 to your computer and use it in GitHub Desktop.
/* appjet:version 0.1 */
import("lib-json");
import("lib-html-xpath");
function get_main() {
page.setMode("plain");
var result = [];
var content = wget("http://query.yahooapis.com/v1/public/yql", {
q: 'select * from xml where url="http://fishki.net/rss.xml" and itemPath="rss.channel.item" limit 10',
format: 'json',
callback: ''
});
var json = JSON.parse(decodeURIComponent(escape(content)));
json.query.results.item.forEach(function(item) {
var imgs = xget(item.link, '//img[starts-with(@src,"http://de.fishki.net/picsw/")]');
if(!imgs.img) {
return;
}
result.push({
link: item.link,
title: item.title,
description: imgs.img.map(function(img) {
return '<img src="' + img.src + '" />';
}).join('<br />')
});
});
print(raw(JSON.stringify([].concat(result))));
};
dispatch();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment