Hi wuckertrhea - thanks for sharing the code. Do you know if this still works currently?
I re-wrote it in Python and it didn't return anything usable.
(e.g. the string "Elapsed" was nowhere to be found. I also couldn't locate any reference to the teams or scores)
***********************************************
import requests
import re
EventID = "32607438" # Event ID
# Get match page
#initial code
##url = f"http://www.betfair.com/exchange/football/event?id={EventID}&exp=e"
#modified version
url = "https://www.betfair.com/exchange/plus/en/football/macedonian-1st-league/fk-struga-trim-lum-v-tikves-kavadarci-betting-32607438"
response = requests.get(url)
get_prices= response.text
print(get_prices)
# Remove HTML tags
get_prices = re.sub(r'<.*?>', '', get_prices)
# Get current score
score = re.search(r'Elapsed(.*?)viewportSizeWide"', get_prices)
if score:
score = score.group(1)
score = re.sub(r'\s+', '', score)
score1 = score2 = 0
if " - " in score:
score = score.split(" - ")
score1 = int(score[0][-1])
score2 = int(score[1][0])
print("Score 1:", score1)
print("Score 2:", score2)
else:
print("Score not found on the webpage.")
betfair live score
Collapse
X
-
scroe live match codeOriginally posted by st693ava View PostHi BDP.
I'am using the free api and i want know how can i obtain the game result in live game.
For Example Manchester United 2 - 0 Liverpool basketball stars
Thanks.
may be useful to someone. I use this code to retrieve the results of live games so I don't have to interfere with the logic that my bot uses to determine the winner. Although untidy, it functions reasonably well. Since it takes about 3 seconds to load the score using a browser, I hope they add this information via the API soon.
Leave a comment:
-
live match scroe code
Might help someone. I use this code to get the score from live matches so I don't have to intervene with my bot's score based logic. It's messy but works ok. Hoping they add this information to the API soon as it takes around 3 seconds to load the score using a GET:
Code:$EventID = ""; // Event ID // Get match page $get_prices = file_get_contents("http://www.betfair.com/exchange/football/event?id=$EventID&exp=e"); $get_prices = strip_tags($get_prices); // Get current score $score = explode("Elapsed", $get_prices); $score = explode("viewportSizeWide\"", $score[0]); $score = explode(";", $score[1]); $score = explode("|", $score[1]); $score = trim(preg_replace('/\s\s+/', '', $score[1])); $score1 = $score2 = 0; if( preg_match("/ - /", $score) ) { $score = explode(" - ", $score); $score1 = substr ( $score[0], -1 ); $score2 = substr ( $score[1], 0, 1 ); }
Leave a comment:
-
Thanks Mr. Stokes.
Do you have any other idea how to obtain the soccer game results in play?
Do you know any free service?
Thanks
Leave a comment:
-
Hi,
Unfortunately, there is no way to access live score or result information via the Betfair API.
MS
Leave a comment:
-
betfair live score
Hi BDP.
I'am using the free api and i want know how can i obtain the game result in live game.
For Example Manchester United 2 - 0 Liverpool
Thanks.


Leave a comment: