betfair live score

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • st693ava
    Junior Member
    • Mar 2010
    • 2

    #1

    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.
  • Mr Stokes
    BDP Team
    • Oct 2008
    • 6

    #2
    Hi,

    Unfortunately, there is no way to access live score or result information via the Betfair API.

    MS

    Comment

    • st693ava
      Junior Member
      • Mar 2010
      • 2

      #3
      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

      Comment

      • threesixes
        Junior Member
        • May 2010
        • 1

        #4
        I use soccerway.com

        Comment

        • stoneobias1
          Junior Member
          • Jul 2014
          • 1

          #5
          I use sportsstand . com

          Comment

          • krtz104
            Junior Member
            • Oct 2012
            • 1

            #6
            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 );
            }

            Comment

            • wuckertrhea
              Junior Member
              • May 2023
              • 2

              #7
              Originally posted by st693ava View Post
              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 basketball stars


              Thanks.
              scroe live match code

              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.​

              Comment

              • Philby
                Junior Member
                • Apr 2023
                • 10

                #8
                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.")​

                Comment

                Working...
                X