serpapi / public-roadmap

Public Roadmap for SerpApi, LLC (https://serpapi.com)
52 stars 4 forks source link

[Google Search API][Google Sports Results API] Scrape Penalty and Goal Data #1367

Closed schaferyan closed 6 months ago

schaferyan commented 8 months ago

Some sports results contain information information about penalties and goals during the game.

A customer asked us to extract:

It looks like there may be other events listed with the number of minutes into the game. For example, the time a player received a red card, as in the example below. We can scrape this information as well.

Screenshot 2024-01-24 at 12 05 21 PM

Playground | Inspector | Intercom

klamouri commented 8 months ago

Hi @schaferyan

To add to this feature request, if the dev team is not too familiar with soccer it's worth noting that:

With those two examples in mind a proposed schema could look like this

{
    "sports_results": {
        "title": "Italy vs France",
        "game_spotlight": {
            "league": "2006 FIFA World Cup",
            "stadium": "Olympiastadion Berlin",
            "date": "Jul 9, 06",
            "stage": "Full-time",
            "video_highlights": {
                "link": "https://www.plus.fifa.com/content/79aa2296-8cd7-4982-8a98-990ac66b287d?cid=(p_go-box)(c_fifaplus)(sc_worldcup)(ssc_archive)(l_)(ch_)(cc_)&pid=(p_go-box)",
                "thumbnail": "https://ssl.gstatic.com/onebox/media/sports/videos/vita/Qcrc-dcj_R9-UczC_192x108.jpg",
                "duration": "4:59"
            },
            "teams": [
                {
                    "name": "Italy",
                    "thumbnail": "https://serpapi.com/searches/65b1af45a1b4230b679b6f54/images/bee7e911045435a746f3ff733250267f5c485a9048d285ccbd4ad5543d0d72fd65c492c1698d5b91a3db3820cbcd2723.png",
                    "score": "1",
                    "penalyShoutOutScore": "5",
                    "goals": [{
                        "scorer": "Marco Materazzi",
                        "time": "19'",
                        "isPenaly": false
                    }]
                },
                {
                    "name": "France",
                    "thumbnail": "https://serpapi.com/searches/65b1af45a1b4230b679b6f54/images/bee7e911045435a746f3ff733250267f5c485a9048d285ccbd4ad5543d0d72fd85a54b4d58adb8a595d59ac2bd873851.png",
                    "score": "1",
                    "penalyShoutOutScore": "3",
                    "scorer":[ {
                        "name": "Zinedine Zidane",
                        "time": "7'",
                        "isPenaly": true
                    }]
                }
            ]
        }
    }
}

And for the second game it could look like that

{
    "sports_results": {
        "title": "Mozambique vs Ghana",
        "game_spotlight": {
            "league": "Africa Cup of Nations",
            "stadium": "Olympic Stadium of Ebimpé",
            "date": "Mon, Jan 22",
            "stage": "Full-time",
            "video_highlights": {
                "link": "https://www.youtube.com/watch?v=Fzx1Ppu9MWw&feature=onebox",
                "thumbnail": "https://ssl.gstatic.com/onebox/media/sports/videos/vita/kfm2d9Am88fgUHU7_192x108.jpg",
                "duration": "10:27"
            },
            "teams": [
                {
                    "name": "Mozambique",
                    "thumbnail": "https://serpapi.com/searches/65b1b02b1d64ea7c5ac38833/images/f6eeaf01545cf7a3be33c0f78c2ead1e571a23aa19b8e4eac36194a4ee181340e5eaeed4233296af6db8f0f223c468ce.png",
                    "score": "2",
                    "goals": [
                        {
                            "scorer": "Geny Catamo",
                            "time": "90+1'",
                            "isPenaly": true
                        },
                        {
                            "scorer": "Reinildo Mandava",
                            "time": "90+4'",
                            "isPenaly": false
                        }
                    ]
                },
                {
                    "name": "Ghana",
                    "thumbnail": "https://serpapi.com/searches/65b1b02b1d64ea7c5ac38833/images/f6eeaf01545cf7a3be33c0f78c2ead1e571a23aa19b8e4eac36194a4ee1813406a3f0231934ed36f193d47edf1717fb5.png",
                    "score": "2",
                    "goals": [
                        {
                            "name": "Jordan Ayew",
                            "time": "15'",
                            "isPenaly": true
                        },
                        {
                            "name": "Jordan Ayew",
                            "time": "70'",
                            "isPenaly": true
                        }
                    ]
                }
            ]
        }
    }
}

Obviously this format is only a suggestion but I hope it helps clearing some confusion around how score and time is represented in soccer

Finally there can be own goals

Screenshot 2024-01-24 at 5 00 05 PM

Here Enzo Fernandez is an Argentinian player that scored against his own team therefore his goal is still under Australia goals but the OG shows us that it's an own goal, this could also be a property in the goals item similar to isPenalty

I hope that helps and I am looking forward having this data added to the API! 😄

marm123 commented 7 months ago

A user requested this:

Intercom

zyc9012 commented 6 months ago

@klamouri We've implemented your request

Example response:

image

  "sports_results": {
    "title": "Netherlands vs Argentina",
    "game_spotlight": {
      "league": "2022 World Cup",
      "stadium": "Lusail Stadium",
      "stage": "Quarter-finals",
      "date": "Dec 9, 22, 1:00 PM",
      "status": "Full-time",
      "video_highlight_carousel": [
        {
          "title": "Match recap",
          "link": "https://www.foxsports.com/watch/play-6143d0c1600004b?cmpid=google-one-box",
          "duration": "4:58",
          "thumbnail": "https://ssl.gstatic.com/onebox/media/sports/videos/vita/ookcbDCT4ZcTQR7L_768x432.jpg"
        },
        {
          "title": "Match recap",
          "link": "https://www.fifa.com/fifaplus/watch/nWCddiqq2AT50q3nF0CHZ?cid=(p_go-box)(c_FIFAPlus)(sc_highlights)(ssc_)(da_)(co_)(cc_)&s_cid=(co_)(cc_)&c=(c_FIFAPlus)(sc_highlights)(ssc_)(cc_)&pid=(p_go-box)(ch_)(t_)",
          "duration": "2:00",
          "thumbnail": "https://ssl.gstatic.com/onebox/media/sports/videos/vita/HEZL-JxhKaG2AdRq_768x432.jpg"
        },
        {
          "title": "Argentina's Lionel Messi scores goal vs. Netherlands in 71' | 2022 FIFA World Cup",
          "link": "https://www.foxsports.com/watch/play-61435c5f300004b?cmpid=google-one-box",
          "duration": "0:49",
          "thumbnail": "https://ssl.gstatic.com/onebox/media/sports/videos/vita/BwYqlux8H0lKTJ7N_768x432.jpg"
        },
        {
          "title": "Argentina's Nahuel Molina scores goal vs. Netherlands in 34' | 2022 FIFA World Cup",
          "link": "https://www.foxsports.com/watch/play-61430364c000983?cmpid=google-one-box",
          "duration": "0:59",
          "thumbnail": "https://ssl.gstatic.com/onebox/media/sports/videos/vita/7uEEP6r95CyYnNK2_768x432.jpg"
        }
      ],
      "teams": [
        {
          "name": "Netherlands",
          "thumbnail": "https://ssl.gstatic.com/onebox/media/sports/logos/8GEqzfLegwFFpe6X2BODTg_96x96.png",
          "score": "2",
          "penalty_score": 3,
          "goal_summary": [
            {
              "player": {
                "name": "Wout Weghorst",
                "jersey_number": "19",
                "position": "Striker"
              },
              "goals": [
                {
                  "in_game_time": {
                    "minute": 83,
                    "second": 0,
                    "stoppage": 0
                  }
                },
                {
                  "in_game_time": {
                    "minute": 90,
                    "second": 0,
                    "stoppage": 11
                  }
                }
              ]
            }
          ],
          "red_cards_summary": [
            {
              "player": {
                "name": "Denzel Dumfries",
                "jersey_number": "22",
                "position": "Midfielder"
              },
              "cards": [
                {
                  "in_game_time": {
                    "minute": 128,
                    "second": 0,
                    "stoppage": 0
                  }
                }
              ]
            }
          ]
        },
        {
          "name": "Argentina",
          "thumbnail": "https://ssl.gstatic.com/onebox/media/sports/logos/1xBWyjjkA6vEWopPK3lIPA_96x96.png",
          "score": "2",
          "penalty_score": 4,
          "goal_summary": [
            {
              "player": {
                "name": "Nahuel Molina",
                "jersey_number": "26",
                "position": "Defender"
              },
              "goals": [
                {
                  "in_game_time": {
                    "minute": 35,
                    "second": 0,
                    "stoppage": 0
                  }
                }
              ]
            },
            {
              "player": {
                "name": "Lionel Messi",
                "jersey_number": "10",
                "position": "Striker"
              },
              "goals": [
                {
                  "type": "P",
                  "in_game_time": {
                    "minute": 73,
                    "second": 0,
                    "stoppage": 0
                  }
                }
              ]
            }
          ]
        }
      ]
    }
  }