Help with Python and javascript based sites
#1
I'm running into a few problems when making plugins. For websites that have have multiple pages, for example (...page1.html, page2.html), I have no problem.

I wanted to know if it's possible in python to request urls with javascript links? For example some sites use javascript to browse through pages.

On ESPN, to go to the next page, the link is
Code:
javascript:loadChannel('id',page,'');
Reply
#2
Took a look at the source and here is where the info is pulled from. You should open:

http://espn.go.com/video/beta/libraryPla...categoryid=" + categoryid + "&pageNum=" + pageNum + "&sortBy=" + sortBy + "&assetURL=http://assets.espn.go.com"

Hope this helps

Code:
//load channel
function loadChannel(categoryid, pageNum, sortBy){
    try { document.getElementById("libraryList").innerHTML = "<img src='http://assets.espn.go.com/broadband/video/images/ajax-loader-5.gif'>"; }
    catch(e){ document.getElementById("libraryPlaylist").innerHTML = "<img src='http://assets.espn.go.com/broadband/video/images/ajax-loader-5.gif'>"; }
    var xmlHttp;
    try {xmlHttp = new XMLHttpRequest();}
    catch (e) {
        try {xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");}
        catch (e) {
            try {xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");}
            catch (e) {
                alert("Your browser does not support AJAX!");
                return false;
            }
        }
    }
    xmlHttp.onreadystatechange = function(){
        if(xmlHttp.readyState == 4) document.getElementById("libraryPlaylist").innerHTML = xmlHttp.responseText;
    }
    xmlHttp.open("GET","beta/libraryPlaylist?categoryid=" + categoryid + "&pageNum=" + pageNum + "&sortBy=" + sortBy + "&assetURL=http://assets.espn.go.com", true);
    xmlHttp.send(null);
}
Reply
#3
Thanks Wink
Reply

Logout Mark Read Team Forum Stats Members Help
Help with Python and javascript based sites0