A slack integration for updating start, stop, half-time and goals of WC 2018.
You will need a settings.json
file with the following information (located in the same folder):
{
"slack_instances": [
{
"webhook": "https://hooks.slack.com/services/your/webhook/here",
"channel": "#wc2018"
}
],
"slack_payload": {
"username": "Sportsball",
"icon_emoji": ":soccer:",
"link_names": 1
},
"football-data-token": "token",
"hours_to_add": 0 //this is if you're running it on a server that does not have the same time zone as your local time
}
More instances of slack are supported, just add more dicts with webhook and channel
Requires: python 3.6
Modules not installed by deafult:
- aiohttp
- dateutil (python-dateutil)
Once you start running the script it will update on today's matches, then keep running and update about new goals, half-time score and match endings (with score). Personally running it on a server with a cronjob that starts a screen with the script at 9 in the morning, then kills the screen in the evening.
The different .py files use different ways to find out the information needed:
wc.py
uses the API of https://github.com/estiens/world_cup_jsonfd.py
uses the API of football-data.org (a token from there is needed)google.py
is a webscraper that uses googles real time updates
All of the updaters work on a scraper, which is inherently not a very safe way to gather information. The code is mostly written in a few hours and then trying to monkey-patch once an error is found. Do not use the code as a good example of python code, and keep in mind that the data it relies upon might fail.