From 6648eb93bb02157dbdc6cb8e169714be5b9ed63b Mon Sep 17 00:00:00 2001 From: Rutuja Dhanawade <53823042+rutujadhanawade@users.noreply.github.com> Date: Thu, 1 Oct 2020 22:14:48 +0530 Subject: [PATCH 1/2] Create Readme.md --- Web-Scraping/Sports updates/Readme.md | 30 +++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 Web-Scraping/Sports updates/Readme.md diff --git a/Web-Scraping/Sports updates/Readme.md b/Web-Scraping/Sports updates/Readme.md new file mode 100644 index 00000000..33bcefd8 --- /dev/null +++ b/Web-Scraping/Sports updates/Readme.md @@ -0,0 +1,30 @@ +## Sports Score Updates + - This script fetch the latest score for matches, team info and match info + - This script supports: + - baseball + - basketball + - cricket + - football + - handball + - hockey + - rugby-league + - rugby-union + - soccer + - tennis + - volleyball + + +## Setting up : +### Install requirements: +```sh +$ pip3 install sports-py +``` + +### Running the script: +```sh +# gets the live score: +$ python3 score_updates.py +# gets the details of match between two teams: +$ python3 sports_score_updates.py +# gets the details of a team: +$ python3 sports_score_updates.py From 443ff875d270d4d8e2c62a502db0c1e18b0f2ae7 Mon Sep 17 00:00:00 2001 From: Rutuja Dhanawade <53823042+rutujadhanawade@users.noreply.github.com> Date: Thu, 1 Oct 2020 22:16:28 +0530 Subject: [PATCH 2/2] Add files via upload --- Web-Scraping/Sports updates/score_updates.py | 53 ++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 Web-Scraping/Sports updates/score_updates.py diff --git a/Web-Scraping/Sports updates/score_updates.py b/Web-Scraping/Sports updates/score_updates.py new file mode 100644 index 00000000..6e86aac7 --- /dev/null +++ b/Web-Scraping/Sports updates/score_updates.py @@ -0,0 +1,53 @@ +import sports +import sys + +sdict = { + 'baseball': sports.BASEBALL, + 'basketball': sports.BASKETBALL, + 'cricket': sports.CRICKET, + 'football': sports.FOOTBALL, + 'handball': sports.HANDBALL, + 'hockey': sports.HOCKEY, + 'rugby-league': sports.RUGBY_L, + 'rugby-union': sports.RUGBY_U, + 'soccer': sports.SOCCER, + 'tennis': sports.TENNIS, + 'volleyball': sports.VOLLEYBALL +} + +arguments = sys.argv +if (len(arguments) < 2): + print('Please enter a sport as a argument we support these sports.') + for a in sdict.keys(): + print(a) + exit() + +if (len(arguments) == 2): + sport = arguments[1].lower() + if sport in sdict.keys(): + all_matches = sports.all_matches()[sport] + for match in all_matches: + print(match) + else: + print('This sport details are not supported yet') + +if (len(arguments) == 3): + sport = arguments[1].lower() + if (sport == 'baseball' or sport == 'basketball' or sport == 'football' or sport == 'hockey'): + sport = sdict.get(sport) + team = arguments[2].lower() + team_info = sports.get_team(sport, team) + print(team_info) + else: + print('This sport details are not supported yet') + +if (len(arguments) == 4): + sport = arguments[1].lower() + if sport in sports_dict.keys(): + sport = sports_dict.get(sport) + team1 = arguments[2].lower() + team2 = arguments[3].lower() + match_info = sports.get_match(sport, team1, team2) + print(match_info) + else: + print('This sport details are not supported yet')