Irvine Part30

このエントリーをはてなブックマークに追加
309名無し~3.EXE
//Dorothy2
//caption=ameblo.jpの画像
//version=0.01
//match=http://ameblo\.jp/[^/]+/image-\d+-\d+\.html
//author= 
//path=program
//priority=500
//end
function(){
common_load('download', 'character_references');
var id = urlinfo.url.match(/\/([^\/]+)\/image-(\d+)-(\d+)\./) ? (RegExp.$1 + ' ' + RegExp.$2 + ' ' + RegExp.$3) : '?';
var http = download(urlinfo.url);
if (http.responseHeader.code != 200) { println("error---> " + http.responseHeader.code); exit(); }
var url = http.data.match(/"current":.*?"imgUrl":"([^"]+)"/) ? (new URL('http://stat.ameba.jp/')).expand(RegExp.$1) : '';
if (!url) { println("error---> url not found."); exit(); }
var title = http.data.match(/<h1[^>]*><a[^>]*>(.*?)</) ? character_references(RegExp.$1.fromUTF8toSJIS()) : '';
var ext = File.extractExt((new URL(url)).filename);
Dorothy.fileName = changeFileName('ameblo ' + id + ' ' + title + ext);
headers['Referer'] = urlinfo.url;
urlinfo.url = (new URL(url)).url;
headers['Host'] = (new URL(urlinfo.url)).host;
}