Obtain javascript result
bob gailer
bgailer at gmail.com
Fri Oct 21 13:04:42 EDT 2016
On 10/21/2016 11:07 AM, eproser at gmail.com wrote:
> Yes,
>
> the page is http://www.betexplorer.com/next/soccer/
> and You have to open any match You want.
>
> This pop-up new windows with match detail and odds
> (if present).
>
> I try to extract home team, away team, results, and
> bet365's bookmaker odds.
>
> I can't continue in my fun analyses because the odds
> are returned through that javascript code and
> I don't know how manage it in python
> to take that results.
What version of Python are you using, and what operating system?
I would use splinter (https://pypi.python.org/pypi/splinter)
From a command prompt: pip install splinter
The Python program (this is not tested; your mileage may vary):
from splinter import Browser
browser = Browser(browser)
page =
browser.visit('http://www.betexplorer.com/soccer/russia/youth-league/matchdetails.php?matchid=rLu2Xsdi')
div = browser.find_by_id('be')
text = div.text
text looks like
"
Soccer » Russia » Youth League 2016/201720.10.2016
Cruzeiro-Corinthians
4:2
(1:1, 3:1)
14.Abila Ramon
(penalty kick) 59.Abila Ramon
63.Rodrigo Bruno
83.De Arrascaeta Giorgian
35.Rodriguinho
86.Rildo
1X2 Odds (25)
O/U (100)
AH (33)
DNB (11)
DC (20)
BTS (14)
Bookmakers: 251X2
10Bet1.573.555.05
12BET1.753.554.40
188BET1.723.654.40
888sport1.683.704.80
bet-at-home1.673.404.42
bet3651.733.604.75
Betclic1.653.404.60
Betfair1.663.404.40
Betsafe1.683.504.25
Betsson1.683.504.25
BetVictor1.703.605.00
Betway1.703.404.75
bwin1.673.704.40
ComeOn1.573.555.05
Expekt1.653.404.60
Interwetten1.703.454.50
Ladbrokes1.733.605.00
mybet1.753.504.00
Pinnacle1.753.815.25
SBOBET1.723.504.70
Sportingbet1.673.604.60
Tipico1.653.504.70
Unibet1.683.704.80
William Hill1.733.404.40
youwin1.673.604.60
Average odds 1.693.544.63
close window
$(document).ready(function() {
matchdetails_init('rLu2Xsdi', '1x2');
});
"
I hope you know enough to extract the data you want. There are probably
better ways to drill down to the relevant table rows, but I can't do
that right now as I am having my own problem with splinter.
splinter is the only tool I know that will do this. There may be others.
More information about the Python-list
mailing list