//Dorothy2
//caption=TokyoPornTube
//version=0.00
//match=http://www.tokyo-porn-tube.com/video/\d+/
//author=
//path=program
//priority=500
//end
function(){
common_load('download', 'character_references');
var id = urlinfo.url.match(/\/video\/(\d+)\//) ? RegExp.$1 : '0';
var http = download(urlinfo.url);
if(http.responseHeader.code != 200) { println("error---> page " + http.responseHeader.code); exit(); }
var title = http.data.match(/
([^<>]+)) ? character_references(RegExp.$1.fromUTF8toSJIS()).trim() : '?';
println("title = " + title);
http = download('http://www.tokyo-porn-tube.com/media/player/config.php?vkey=' + id);
if(http.responseHeader.code != 200) { println("error---> xml " + http.responseHeader.code); exit(); }
var url = http.data.match(/(http[^<>]+)<\/src>/) ? RegExp.$1.replace(/&/g,'&') : null;
if(http.data.match(/(http[^<>]+)<\/hd>/)) {
url = RegExp.$1.replace(/&/g,'&');
println("HD");
}
if(!url) { println("error---> url not found"); exit(); }
urlinfo.url = (new URL(url)).url;
headers['Host'] = (new URL(urlinfo.url)).host;
headers['Referer'] = '';
Dorothy.fileName = changeFileName(title + ' tpt=' + id + '.flv');
}