Skip to content

Instantly share code, notes, and snippets.

@youpy
Created June 14, 2009 17:38
Show Gist options
  • Save youpy/129757 to your computer and use it in GitHub Desktop.
Save youpy/129757 to your computer and use it in GitHub Desktop.
/* appjet:version 0.1 */
import("lib-json");
function get_main() {
page.setMode("plain");
// PST to JST
var date = new Date(new Date().getTime() + 17 * 3600 * 1000);
date.setSeconds(0);
date.setMinutes(0);
date.setHours(0);
var results = [];
var content = wget('http://www.bijogoyomi.com/bijo/detail.php?c=' + ((date.getTime() + '').replace(/\d\d\d$/, '')));
try {
var name = content.match(/<name><!\[CDATA\[(.+)\]\]><\/name>/)[1];
var age = content.match(/<age><!\[CDATA\[(.+)\]\]><\/age>/)[1];
var profile = content.match(/<profile><!\[CDATA\[(.+)\]\]><\/profile>/)[1];
} catch(e) {
return print('[]');
}
var dateString = date.getFullYear()
+ ((date.getMonth() + 1 < 10) ? '0' : '')
+ (date.getMonth() + 1)
+ ((date.getDate() < 10) ? '0' : '')
+ date.getDate();
var matches = content.match(/http[^"]+\.jpg/g);
matches.forEach(function(url, index) {
var image_id = url.match(/(\d+)\.jpg$/)[1];
results.push({
title: [name, age, profile].join(' '),
link: 'http://www.bijogoyomi.com/bijo/#/' + dateString + '/' + image_id,
description: '<img src="' + url + '" />'
});
});
print(raw(JSON.stringify(results)));
};
dispatch();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment