Source of itunes-proxy

/* appjet:version 0.1 */import("storage");var base = "ax.itunes.apple.com";var proxyBase = "itunes-proxy.jgate.de";var baseUrl = "http://" + base;var proxyBaseUrl = "http://" + proxyBase;var url_group = baseUrl + "/WebObjects/MZStore.woa/wa/viewGrouping";var kind = request.params["displayable-kind"];/** * Returns the proxied content */function getContent(url, id, s){    var resp;    if (id != undefined && s != undefined)    {        resp = wget(url, {id: id, s: s}, storage.headers);    }    else if (id != undefined && kind == undefined)    {        resp = wget(url, {id: id}, storage.headers);    }    else        resp = "<br /><a href='" + proxyBaseUrl + "'>Home</a>" + "<br />" + " (id: " + id + ", kind: " + kind + ")";    resp = resp.replace(/http:\/\/ax.itunes.apple.com/g, proxyBaseUrl  + "/" + base);    resp = resp.replace(/src=\"\/images/g, 'src="' + baseUrl + "/images");    return resp;}var id = request.params.id;var s = request.params.s;var path = request.path;var ids = {32: "37"};if (path.indexOf("/ax.itunes.apple.com") == 0){    var url = path.substring(base.length + 1);    // genres    if (path.indexOf("viewGenre") != -1)        print(html(getContent(url_group, ids[id], s)));    else    {//        printp("baseurl: " + baseUrl);//        printp("url: " + url)//        printp("id" + id)//        printp("s" + s)        print(html(getContent(baseUrl + url, id, s)));    }}else dispatch();function get_main(){    import("quickforms");    print(H2("iTunes 9 Proxy"));    var form = new QuickForm();    form.addHeading("h", html("Enter an iTunes store link.", BR()));    form.addInputText("storeurl", {label"iTunes Store URL:", value: "http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewAlbum?id=329649079", size: "100"});    form.addSubmit("store""Browse Store");    print(form);    print(html(BR(), "Browse The iTunes Store: ",        link("http://itunes-proxy.jgate.de/ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewGrouping?id=1""Music"), " | ",        link("http://itunes-proxy.jgate.de/ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewGrouping?id=39""Movies"), " | ",        link("http://itunes-proxy.jgate.de/ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewGrouping?id=37""TV Shows"), " | ",        link("http://itunes-proxy.jgate.de/ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewGrouping?id=25204""App Store"), " | ",        link("http://itunes-proxy.jgate.de/ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewGrouping?id=33""Podcasts"), " | ",        link("http://itunes-proxy.jgate.de/ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewGrouping?id=28""Audiobooks")    ));}function post_main(){    var url = request.params["storeurl"];    var params = url.split("?");    url = params[0].replace(/http:\/\//, "http://ax.");    id = params[1].substring(3);    //print("Url: " + url + ", id: " + id);    print(html(getContent(url, id)));}

Go Back to this app | Get plain source

Powered by AppJet on JGate
source
rendered in 0.482s