Created
March 21, 2009 20:17
-
-
Save youpy/82965 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
/* 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