I'm trying to a scrape using Python a certain type of website (this one for example) that usesAJAX
requests with jquery
to load some of it's content (I'm also aware of the very good post here, but at the moment I think Selenium might be unnecessary for my problem).
I can see using Firebug that when I load a menu cookies get set in a logical way, which use numbering system to group events like:
(Sport, Country, Competition, Event)
e.g. for all Soccer, England events the numbers are
(7, 55,0,0)
Then when the javacript function updateCenter()
is called, it uses this set of cookies to build a URL based on these cookie values, like:
var loadUrl = "/_betting/getCenterColumn/" + centerStateCookie + "/" + selectedSport
+ "&" + selectedCategory + "&" + selectedCompetition + "&" + selectedEvent + "&" +
selectedLiveNowEvent + "&" + expandBetNbrInActiveSettledBets;
For my example above this looks like:
/_betting/getCenterColumn/displayEventsFromCategory/7&55&0&0&0&0
Finally an AJAX
request is made to update the center DIV with content loaded from that URL:
(the .html(ajax_load)
initial call just loads a nice whirly timer gif in the meantime while request is processed):
$("#PluginBettingCenterContent").html(ajax_load).load(loadUrl);
All well and good, but the Firebug XHR requests actually show that the GET link requested wasn't quite the above but has some numbers appended:
GET /_betting/getCenterColumn/displayEventsFromCategory/7&55&0&0&0&0?_=1392198690842
Where does this ?_=1392198690842
come from in such an AJAX
request?
Since I can easy scrape and build the URL that goes into the AJAX
load, I was hoping just to scrape these URLs directly, but I don't understand what the final set of numbers and ?_=
appended to this URL GET request are, and how I could simulate computing them....