Mein erster python Versuch
Ich habe seit Mitte Juni ’24 Python installiert und mein erster Gedanke war, Liga Ergebnisse (die football-bet-data nicht anbietet) in ein Excel-Sheet zu generieren und diesen Datenbestand für meine football scalping strategy zu nutzen. Sofascore.com bietet die meines Erachtens beste Möglichkeit, an annähernd lückenlose „goal times“ zu gelangen.
Hier also mein erstes Ergebnis,- entstanden mit viel trial and error, Forumsbeiträgen und Chat GPT.
import requests import pandas as pd import os import time def get_all_events(tournament_id, season_id): result = [] i = 0 hasNextPage = True while hasNextPage: url = f'https://www.sofascore.com/api/v1/unique-tournament/{tournament_id}/season/{season_id}/events/last/{i}' response = requests.get(url) data = response.json() hasNextPage = data.get('hasNextPage') result.extend(reversed(data.get('events', []))) i += 1 return result def get_match_incidents(event_id): url = f'https://www.sofascore.com/api/v1/event/{event_id}/incidents' response = requests.get(url) data = response.json() return data.get('incidents', []) def main(tournament_id, season_id, output_file): data = [] matches = get_all_events(tournament_id, season_id) for match in matches: incidents = get_match_incidents(match['id']) data.append([ match['tournament']['name'], match['homeTeam']['name'], match['awayTeam']['name'], match['homeScore'].get('current', 'N/A'), match['awayScore'].get('current', 'N/A'), time.strftime('%x %X', time.localtime(int(match['startTimestamp']))), ', '.join(f"{i['time']}'" for i in incidents if i['incidentType'] == 'goal') ]) headers = ['Tournament', 'Home Team', 'Away Team', 'Home Score', 'Away Score', 'Start Date', 'Goal Times'] df = pd.DataFrame(data, columns=headers) df.to_excel(output_file, index=False) if __name__ == '__main__': tournament_id = 709 season_id = 53263 output_file = "Aserbaidschan_1_23-24.xlsx" main(tournament_id, season_id, output_file)
Das Skript sammelt Daten zu Fußballspielen der 1. Liga von Aserbaidschan, Saison 23/24 und speichert die Ergebnisse in eine Excel Datei im gleichen Verzeichnis wie die ausführende python. Es läuft relativ langsam,- das mindert die Wahrscheinlichkeit, das die IP geblockt wird.
football scalping strategy, goal times, Excel download, Mathematical solutions in Excel for football betting. Football Scalping Strategy and Excel. Betting model and scalping strategy with Excel. teaches the fundamentals of finance and statistics and helps you to understand and master the betting market. Enlightening. Independent. Honest. Scientific, In-Play Football