This commit is contained in:
louiscklaw
2025-01-31 20:05:06 +08:00
parent 2a6f19a43f
commit cd995ed8bd
115 changed files with 7626 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
#!/usr/bin/env bash
set -x
sudo apt-get update
sudo apt-get install -qqy libnss3\
libnspr4\
libdbus-1-3\
libatk1.0-0\
libatk-bridge2.0-0\
libcups2\
libdrm2\
libxkbcommon0\
libatspi2.0-0\
libxcomposite1\
libxdamage1\
libxfixes3\
libxrandr2\
libgbm1\
libasound2
sudo apt-get install -qqy python3 python3-pip

View File

@@ -0,0 +1,5 @@
#!/usr/bin/env bash
set -x
pip install -r requirements.txt

View File

@@ -0,0 +1,5 @@
#!/usr/bin/env bash
set -x
playwright install

View File

@@ -0,0 +1,34 @@
FROM python:latest
RUN apt update && \
apt install -y git && \
useradd -m docker_user && \
chown -R docker_user: /home/docker_user
RUN mkdir -p /home/docker_user/.local
RUN mkdir -p /home/docker_user/.local/bin
RUN mkdir -p /home/docker_user/.local/lib
RUN mkdir -p /home/docker_user/.cache
ENV PATH="/home/docker_user/.local/bin:${PATH}"
RUN chown 1000:1000 -R /home/docker_user
RUN apt-get update && apt-get install -qqy libnss3\
libnspr4\
libdbus-1-3\
libatk1.0-0\
libatk-bridge2.0-0\
libcups2\
libdrm2\
libxkbcommon0\
libatspi2.0-0\
libxcomposite1\
libxdamage1\
libxfixes3\
libxrandr2\
libgbm1\
libasound2
USER docker_user
WORKDIR /app

View File

@@ -0,0 +1,10 @@
#!/usr/bin/env bash
set -x
jupyter notebook \
--allow-root \
--ip=0.0.0.0 \
--NotebookApp.token='' \
--NotebookApp.password='' \
--notebook-dir=notebook

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,7 @@
#!/usr/bin/env python3
import os,sys
def helloworld():
print("helloworld")

View File

@@ -0,0 +1,69 @@
#!/usr/bin/env python
import os
import sys
import requests
import json
# https://api.footylogic.com/match/h2h/recentform-information
# ?languageId=19
# &channelId=1
# &homeTeamId=50003297
# &awayTeamId=50000948
# &marketGroupId=1
# &optionIdH=1
# &optionIdA=1
# &mode=1
def getBannerJson(eventId):
# https://api.footylogic.com/match/h2h/recentform-information?languageId=19&channelId=1&homeTeamId=50000180&awayTeamId=50000599&marketGroupId=1&optionIdH=1&optionIdA=1&mode=1
url = 'https://api.footylogic.com/match/h2h/banner'
params = {
'languageId': '19',
'channelId': '1',
'eventId': eventId,
}
headers = {
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:121.0) Gecko/20100101 Firefox/121.0',
'Accept': '*/*',
'Accept-Language': 'en-US,en;q=0.5',
'Accept-Encoding': 'gzip, deflate, br',
'Referer': 'https://footylogic.com/',
'Origin': 'https://footylogic.com',
'Connection': 'keep-alive',
'Sec-Fetch-Dest': 'empty',
'Sec-Fetch-Mode': 'cors',
'Sec-Fetch-Site': 'same-site',
'Pragma': 'no-cache',
'Cache-Control': 'no-cache'
}
response = requests.get(url, params=params, headers=headers)
response_json = json.loads(response.text)
# https://footylogic.com/en/tournament/league/{competitionId}/standings
os_cwd = os.getcwd()
json_store_path = os_cwd+'/jsons'
with open(json_store_path+"/banner.json", 'w+') as f_out_json:
json.dump(response_json['data'], f_out_json)
print('Banner.py: get banner json done')
return response_json['data']
def getTeams(json_in):
homeTeamId = json_in['homeTeamId']
awayTeamId = json_in['awayTeamId']
return [homeTeamId, awayTeamId]
def getCompetitionName(json_in):
competitionName = json_in['competitionName']
return competitionName

View File

@@ -0,0 +1,60 @@
#!/usr/bin/env python
import os
import sys
import requests
import json
# https://api.footylogic.com/match/h2h/recentform-information
# ?languageId=19
# &channelId=1
# &homeTeamId=50003297
# &awayTeamId=50000948
# &marketGroupId=1
# &optionIdH=1
# &optionIdA=1
# &mode=1
def getRecentformInformationJson(homeTeamId, awayTeamId):
# https://api.footylogic.com/match/h2h/recentform-information?languageId=19&channelId=1&homeTeamId=50000180&awayTeamId=50000599&marketGroupId=1&optionIdH=1&optionIdA=1&mode=1
url = 'https://api.footylogic.com/match/h2h/recentform-information'
params = {
'languageId': '19',
'channelId': '1',
'homeTeamId': homeTeamId,
'awayTeamId': awayTeamId,
'marketGroupId': '1',
'optionIdH': '1',
'optionIdA': '1',
'mode': '1'
}
headers = {
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:121.0) Gecko/20100101 Firefox/121.0',
'Accept': '*/*',
'Accept-Language': 'en-US,en;q=0.5',
'Accept-Encoding': 'gzip, deflate, br',
'Referer': 'https://footylogic.com/',
'Origin': 'https://footylogic.com',
'Connection': 'keep-alive',
'Sec-Fetch-Dest': 'empty',
'Sec-Fetch-Mode': 'cors',
'Sec-Fetch-Site': 'same-site',
'Pragma': 'no-cache',
'Cache-Control': 'no-cache'
}
response = requests.get(url, params=params, headers=headers)
response_json = json.loads(response.text)
# https://footylogic.com/en/tournament/league/{competitionId}/standings
os_cwd = os.getcwd()
json_store_path = os_cwd+'/jsons'
with open(json_store_path+"/recentfrom-information.json", 'w+') as f_out_json:
json.dump(response_json['data'], f_out_json)
return response_json['data']

View File

@@ -0,0 +1,60 @@
#!/usr/bin/env python
import os
import sys
import requests
import json
# https://api.footylogic.com/match/h2h/recentform-information
# ?languageId=19
# &channelId=1
# &homeTeamId=50003297
# &awayTeamId=50000948
# &marketGroupId=1
# &optionIdH=1
# &optionIdA=1
# &mode=1
def getRecentformInformationAwayTeamJson(homeTeamId, awayTeamId):
# https://api.footylogic.com/match/h2h/recentform-information?languageId=19&channelId=1&homeTeamId=50000180&awayTeamId=50000599&marketGroupId=1&optionIdH=1&optionIdA=1&mode=1
url = 'https://api.footylogic.com/match/h2h/recentform-information'
params = {
'languageId': '19',
'channelId': '1',
'homeTeamId': homeTeamId,
'awayTeamId': awayTeamId,
'marketGroupId': '1',
'optionIdH': '2',
'optionIdA': '3',
'mode': '1'
}
headers = {
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:121.0) Gecko/20100101 Firefox/121.0',
'Accept': '*/*',
'Accept-Language': 'en-US,en;q=0.5',
'Accept-Encoding': 'gzip, deflate, br',
'Referer': 'https://footylogic.com/',
'Origin': 'https://footylogic.com',
'Connection': 'keep-alive',
'Sec-Fetch-Dest': 'empty',
'Sec-Fetch-Mode': 'cors',
'Sec-Fetch-Site': 'same-site',
'Pragma': 'no-cache',
'Cache-Control': 'no-cache'
}
response = requests.get(url, params=params, headers=headers)
response_json = json.loads(response.text)
# https://footylogic.com/en/tournament/league/{competitionId}/standings
os_cwd = os.getcwd()
json_store_path = os_cwd+'/jsons'
with open(json_store_path+"/recentfrom-information-away-team.json", 'w+') as f_out_json:
json.dump(response_json['data'], f_out_json)
return response_json['data']

View File

@@ -0,0 +1,60 @@
#!/usr/bin/env python
import os
import sys
import requests
import json
# https://api.footylogic.com/match/h2h/recentform-information
# ?languageId=19
# &channelId=1
# &homeTeamId=50003297
# &awayTeamId=50000948
# &marketGroupId=1
# &optionIdH=1
# &optionIdA=1
# &mode=1
def getRecentformInformationHomeTeamJson(homeTeamId, awayTeamId):
# https://api.footylogic.com/match/h2h/recentform-information?languageId=19&channelId=1&homeTeamId=50000180&awayTeamId=50000599&marketGroupId=1&optionIdH=1&optionIdA=1&mode=1
url = 'https://api.footylogic.com/match/h2h/recentform-information'
params = {
'languageId': '19',
'channelId': '1',
'homeTeamId': homeTeamId,
'awayTeamId': awayTeamId,
'marketGroupId': '1',
'optionIdH': '2',
'optionIdA': '1',
'mode': '1'
}
headers = {
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:121.0) Gecko/20100101 Firefox/121.0',
'Accept': '*/*',
'Accept-Language': 'en-US,en;q=0.5',
'Accept-Encoding': 'gzip, deflate, br',
'Referer': 'https://footylogic.com/',
'Origin': 'https://footylogic.com',
'Connection': 'keep-alive',
'Sec-Fetch-Dest': 'empty',
'Sec-Fetch-Mode': 'cors',
'Sec-Fetch-Site': 'same-site',
'Pragma': 'no-cache',
'Cache-Control': 'no-cache'
}
response = requests.get(url, params=params, headers=headers)
response_json = json.loads(response.text)
# https://footylogic.com/en/tournament/league/{competitionId}/standings
os_cwd = os.getcwd()
json_store_path = os_cwd+'/jsons'
with open(json_store_path+"/recentfrom-information-home-team.json", 'w+') as f_out_json:
json.dump(response_json['data'], f_out_json)
return response_json['data']

View File

@@ -0,0 +1,54 @@
#!/usr/bin/env python3
import os
import sys
import requests
import json
from pprint import pprint
# https://api.footylogic.com/match/seasonalstats/dropdown-filters
# ?languageId=19
# &channelId=1
# &tableId=1
# &competitionId=50016467
# &tabId=1
def getDropdownFilters(competitionId="competitionId"):
url = 'https://api.footylogic.com/match/seasonalstats/dropdown-filters'
params = {
'languageId': '19',
'channelId': '1',
'tableId': '1',
'competitionId': competitionId,
'tabId': '1',
}
headers = {
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:121.0) Gecko/20100101 Firefox/121.0',
'Accept': '*/*',
'Accept-Language': 'en-US,en;q=0.5',
'Accept-Encoding': 'gzip, deflate, br',
'Referer': 'https://footylogic.com/',
'Origin': 'https://footylogic.com',
'Connection': 'keep-alive',
'Sec-Fetch-Dest': 'empty',
'Sec-Fetch-Mode': 'cors',
'Sec-Fetch-Site': 'same-site',
'Pragma': 'no-cache',
'Cache-Control': 'no-cache'
}
response = requests.get(url, params=params, headers=headers)
response_json = json.loads(response.text)
response_json_data = response_json['data']
# https://footylogic.com/en/tournament/league/{competitionId}/standings
with open("./dropdown-filters.json", 'w+') as f_out_json:
json.dump(response_json_data, f_out_json)
print('DropdownFilters.py: get getDropdownFilters json done')
return response_json_data

View File

@@ -0,0 +1,52 @@
#!/usr/bin/env python
import os
import sys
import requests
import json
def getMarketsInfoJson(eventId, homeTeamId, awayTeamId, competitionId):
# https://api.footylogic.com/match/statistics/markets-info?channelId=1&languageId=1&eventId=50024534&seasonId=1&homeTeamId=50000180&awayTeamId=50000599&competitionId=50024169
url = 'https://api.footylogic.com/match/statistics/markets-info'
params = {
'languageId': '19',
'channelId': '1',
'eventId': eventId,
'seasonId': '1',
'homeTeamId': homeTeamId,
'awayTeamId': awayTeamId,
'competitionId': competitionId,
}
headers = {
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:121.0) Gecko/20100101 Firefox/121.0',
'Accept': '*/*',
'Accept-Language': 'en-US,en;q=0.5',
'Accept-Encoding': 'gzip, deflate, br',
'Referer': 'https://footylogic.com/',
'Origin': 'https://footylogic.com',
'Connection': 'keep-alive',
'Sec-Fetch-Dest': 'empty',
'Sec-Fetch-Mode': 'cors',
'Sec-Fetch-Site': 'same-site',
'Pragma': 'no-cache',
'Cache-Control': 'no-cache'
}
response = requests.get(url, params=params, headers=headers)
response_json = json.loads(response.text)
response_json_data = response_json['data']
os_cwd = os.getcwd()
json_store_path = os_cwd+'/jsons'
with open(json_store_path+"/markets-info.json", 'w+') as f_out_json:
f_out_json.truncate(0)
json.dump(response_json_data, f_out_json)
# https://footylogic.com/en/tournament/league/{competitionId}/standings
print('MarketsInfo.py: getMarketsInfoJson done')
return response_json_data

View File

@@ -0,0 +1,57 @@
#!/usr/bin/env python
import os
import sys
import requests
import json
def getCompetitionsJson():
url = 'https://api.footylogic.com/tournament/competitions'
params = {
'languageId': '19',
'channelId': '1',
'categoryId': '1'
}
headers = {
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:121.0) Gecko/20100101 Firefox/121.0',
'Accept': '*/*',
'Accept-Language': 'en-US,en;q=0.5',
'Accept-Encoding': 'gzip, deflate, br',
'Referer': 'https://footylogic.com/',
'Origin': 'https://footylogic.com',
'Connection': 'keep-alive',
'Sec-Fetch-Dest': 'empty',
'Sec-Fetch-Mode': 'cors',
'Sec-Fetch-Site': 'same-site',
'Pragma': 'no-cache',
'Cache-Control': 'no-cache'
}
response = requests.get(url, params=params, headers=headers)
response_json = json.loads(response.text)
# from pprint import pprint
# https://footylogic.com/en/tournament/league/{competitionId}/standings
expanded_json = response_json
for data in expanded_json['data']:
for competition in data['competitions']:
competitionId = str(competition['competitionId'])
competition['standing_table_link'] = 'https://footylogic.com/en/tournament/league/' + \
competitionId+'/standings'
with open("./competitions.json", 'w+') as f_out_json:
f_out_json.truncate(0)
json.dump(expanded_json['data'], f_out_json)
return expanded_json['data']
def lookupCompetitionId(competitions_json, competitionName):
for category in competitions_json:
for competition in category['competitions']:
if competition['competitionName'] == competitionName:
return competition['competitionId']
return 'not found'

View File

@@ -0,0 +1,57 @@
#!/usr/bin/env python
import os
import sys
import requests
import json
from pprint import pprint
USE_TEST_URL = int(os.getenv('USE_TEST_URL', False))
# https://api.footylogic.com/tournament/options?
# languageId=19
# &channelId=1
# &competitionId=50019599
# &seasonId=4456
def getOptionsJson(competition_id, season_id):
url = 'https://api.footylogic.com/tournament/options'
test_url = 'http://localhost:8081/tournament/options/options.json'
url = [url, test_url][USE_TEST_URL]
params = {
'languageId': '19',
'channelId': '1',
'competitionId': str(competition_id),
'optionId': '1',
'seasonId': str(season_id),
}
headers = {
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:121.0) Gecko/20100101 Firefox/121.0',
'Accept': '*/*',
'Accept-Language': 'en-US,en;q=0.5',
'Accept-Encoding': 'gzip, deflate, br',
'Referer': 'https://footylogic.com/',
'Origin': 'https://footylogic.com',
'Connection': 'keep-alive',
'Sec-Fetch-Dest': 'empty',
'Sec-Fetch-Mode': 'cors',
'Sec-Fetch-Site': 'same-site',
'Pragma': 'no-cache',
'Cache-Control': 'no-cache'
}
response = requests.get(url, params=params, headers=headers)
response_json = json.loads(response.text)
response_json_data = response_json['data']
os_cwd = os.getcwd()
json_store_path = os_cwd+'/jsons'
with open(json_store_path+"/options.json", 'w+') as f_out_json:
f_out_json.truncate(0)
json.dump(response_json_data, f_out_json)
print('Options.py: get options done')
return response_json_data

View File

@@ -0,0 +1,69 @@
#!/usr/bin/env python
import os
import sys
import requests
import json
from pprint import pprint
USE_TEST_URL = int(os.getenv('USE_TEST_URL', False))
# https://api.footylogic.com/tournament/standings?
# languageId=19
# &channelId=1
# &competitionId=50016467
# &optionId=1
# &seasonId=4418
# &layoutId=1
# &roundId=13410
# &tabId=1
# &group=all
def getStandingsJson(competition_id, season_id, round_id):
url = 'https://api.footylogic.com/tournament/standings'
test_url = 'http://localhost:8081/tournament/standings/standings.json'
url = [url, test_url][USE_TEST_URL]
params = {
'languageId': '19',
'channelId': '1',
'competitionId': str(competition_id),
'optionId': '1',
'seasonId': str(season_id),
'layoutId': '1',
'roundId': str(round_id),
'tabId': '1',
'group': 'all',
}
headers = {
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:121.0) Gecko/20100101 Firefox/121.0',
'Accept': '*/*',
'Accept-Language': 'en-US,en;q=0.5',
'Accept-Encoding': 'gzip, deflate, br',
'Referer': 'https://footylogic.com/',
'Origin': 'https://footylogic.com',
'Connection': 'keep-alive',
'Sec-Fetch-Dest': 'empty',
'Sec-Fetch-Mode': 'cors',
'Sec-Fetch-Site': 'same-site',
'Pragma': 'no-cache',
'Cache-Control': 'no-cache'
}
response = requests.get(url, params=params, headers=headers)
response_json = json.loads(response.text)
response_json_data = response_json['data']
os_cwd = os.getcwd()
json_store_path = os_cwd+'/jsons'
with open(json_store_path+"/standings.json", 'w+') as f_out_json:
f_out_json.truncate(0)
json.dump(response_json_data, f_out_json)
print('Standings.py: get standings done')
return response_json_data

View File

@@ -0,0 +1,75 @@
#!/usr/bin/env python3
import os
import sys
import re
import json
import requests
from pprint import pprint
def getMatchesJson():
url = 'https://bet.hkjc.com/football/getJSON.aspx?jsontype=odds_hil.aspx'
headers = {
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:121.0) Gecko/20100101 Firefox/121.0',
'Accept': '*/*',
'Accept-Language': 'en-US,en;q=0.5',
'Accept-Encoding': 'gzip, deflate, br',
'Referer': 'https://footylogic.com/',
'Origin': 'https://footylogic.com',
'Connection': 'keep-alive',
'Sec-Fetch-Dest': 'empty',
'Sec-Fetch-Mode': 'cors',
'Sec-Fetch-Site': 'same-site',
'Pragma': 'no-cache',
'Cache-Control': 'no-cache'
}
response = requests.get(url, headers=headers)
response_json = json.loads(response.text)
# response_json_tournaments = response_json['tournaments']
response_json_matches = response_json['matches']
os_cwd = os.getcwd()
# json_store_path = os_cwd+'/jsons'
with open("./matches_list.json", 'w+') as f_out_json:
f_out_json.truncate(0)
json.dump(response_json_matches, f_out_json)
# print('get odds_hil done')
return response_json_matches
def getMatchesList(matches_json):
output = {}
for match in matches_json:
matchDay = match['matchDay']
matchID = match['matchID']
matchDate = match['matchDate']
matchYYYYMMDD = matchDate.split('T')[0]
tournamentID = match['tournament']['tournamentID']
tournamentNameEN = match['tournament']['tournamentNameEN']
tournamentNameCH = match['tournament']['tournamentNameCH']
homeTeam_teamNameEN = match['homeTeam']['teamNameEN']
awayTeam_teamNameEN = match['awayTeam']['teamNameEN']
homeTeam_teamNameCH = match['homeTeam']['teamNameCH']
awayTeam_teamNameCH = match['awayTeam']['teamNameCH']
tournament_string = "tournamentNameEN(tournamentNameCH)"
tournament_string = tournament_string.replace(
"tournamentNameEN", tournamentNameEN)
tournament_string = tournament_string.replace(
"tournamentNameCH", tournamentNameCH)
vs_string = 'home_en(home_ch) vs away_en(away_ch)'
vs_string = vs_string.replace('home_en', homeTeam_teamNameEN)
vs_string = vs_string.replace('away_en', awayTeam_teamNameEN)
vs_string = vs_string.replace('home_ch', homeTeam_teamNameCH)
vs_string = vs_string.replace('away_ch', awayTeam_teamNameCH)
temp = ','.join([matchYYYYMMDD, tournament_string, vs_string])
output[temp] = [tournamentID, matchID]
return output

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,7 @@
#!/usr/bin/env bash
set -ex
export PYTHONDONTWRITEBYTECODE=1
python3 getJSON.py

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
{"Season": [{"id": 4479, "name": "2023/24 ", "competitionId": 50015432}, {"id": 4228, "name": "2022/23 ", "competitionId": 50015432}, {"id": 3931, "name": "2021/22 ", "competitionId": 50015432}], "Options": [{"id": 1, "name": "All", "competitionId": 50015432}, {"id": 2, "name": "Home", "competitionId": 50015432}, {"id": 3, "name": "Away", "competitionId": 50015432}], "betType": [{"id": 1, "name": "HalfTime", "competitionId": 50015432}, {"id": 2, "name": "FullTime", "competitionId": 50015432}]}

View File

@@ -0,0 +1 @@
{"eventId": "50029247", "homeTeamLogo": 11206, "awayTeamLogo": 11285, "homeTeamName": "Olympiakos", "awayTeamName": "Fiorentina", "competitionName": "UE Conference", "kickOffTime": "2024-05-29 19:00:00", "homeOdds": 3, "awayOdds": 2.18, "drawOdds": 2.92, "homeTeamId": 50002337, "homeTeamIdNav": null, "awayTeamId": 50001245, "awayTeamIdNav": 50001245, "matchNumber": null, "homeTeamPos": null, "awayTeamPos": "8", "matchDayCode": "FB6853", "competitionId": 50015432, "tournamentType": "League", "homePlayerAnalysis": 2, "awayPlayerAnalysis": 2, "homeLeagueShortName": null, "awayLeagueShortName": "ITA L1", "competitionIdNav": 50015432}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
[{"id": 13573, "name": "Qualifying", "levelId": 687, "layoutName": "ROUND_BY_ROUND_LEG_2", "layoutId": 4, "displayOrder": 3, "engName": "Qualifying", "subLevels": [{"id": 13573, "name": "1st Qualifying Round", "levelId": 689, "layoutName": "ROUND_BY_ROUND_LEG_2", "layoutId": 4, "engName": "1st Qualifying Round"}, {"id": 13574, "name": "2nd Qualifying Round", "levelId": 684, "layoutName": "ROUND_BY_ROUND_LEG_2", "layoutId": 4, "engName": "2nd Qualifying Round"}, {"id": 13575, "name": "3rd Qualifying Round", "levelId": 685, "layoutName": "ROUND_BY_ROUND_LEG_2", "layoutId": 4, "engName": "3rd Qualifying Round"}, {"id": 13576, "name": "Play-Offs", "levelId": 688, "layoutName": "ROUND_BY_ROUND_LEG_2", "layoutId": 4, "engName": "Play-Offs"}]}, {"id": 13577, "name": "Group Stage", "levelId": 686, "layoutName": "GROUP_TABLE", "layoutId": 2, "displayOrder": 7, "subLevels": [], "engName": "Group Stage"}, {"id": 13572, "name": "Knockout Stage", "levelId": 691, "layoutName": "ROUND_BY_ROUND_LEG_2", "layoutId": 4, "displayOrder": 8, "engName": "Knockout Stage", "subLevels": [{"id": 13572, "name": "Preliminary Knockout Round", "levelId": 701, "layoutName": "ROUND_BY_ROUND_LEG_2", "layoutId": 4, "engName": "Preliminary Knockout Round"}, {"id": 13578, "name": "Round of 16", "levelId": 690, "layoutName": "ROUND_BY_ROUND_LEG_2", "layoutId": 4, "engName": "Round of 16"}, {"id": 13579, "name": "Quarter Finals", "levelId": 692, "layoutName": "ROUND_BY_ROUND_LEG_2", "layoutId": 4, "engName": "Quarter Finals"}, {"id": 13580, "name": "Semi Final", "levelId": 693, "layoutName": "ROUND_BY_ROUND_LEG_2", "layoutId": 4, "engName": "Semi Final"}, {"id": 13581, "name": "Final", "levelId": 694, "layoutName": "ROUND_BY_ROUND_LEG_1", "layoutId": 3, "engName": "Final"}]}]

View File

@@ -0,0 +1 @@
{"recent8Results": {"homeTeam": [{"competitionName": "Greek Division 1", "kickOff": "2024-05-15 17:00:00", "homeOrAway": "H", "oppTeamName": "AEK Athens", "teamPos": 1, "fullTimeScore": "2:0", "halfTimeScore": "0:0", "fullTimeResult": "W", "firstHalfHad": "D"}, {"competitionName": "UE Conference", "kickOff": "2024-05-09 19:00:00", "homeOrAway": "H", "oppTeamName": "Aston Villa", "teamPos": null, "fullTimeScore": "2:0", "halfTimeScore": "1:0", "fullTimeResult": "W", "firstHalfHad": "W"}, {"competitionName": "Greek Division 1", "kickOff": "2024-04-28 14:00:00", "homeOrAway": "H", "oppTeamName": "Lamia", "teamPos": 9, "fullTimeScore": "4:1", "halfTimeScore": "2:0", "fullTimeResult": "W", "firstHalfHad": "W"}, {"competitionName": "Greek Division 1", "kickOff": "2024-04-21 17:30:00", "homeOrAway": "H", "oppTeamName": "PAOK", "teamPos": 3, "fullTimeScore": "2:1", "halfTimeScore": "1:0", "fullTimeResult": "W", "firstHalfHad": "W"}, {"competitionName": "UE Conference", "kickOff": "2024-04-11 16:45:00", "homeOrAway": "H", "oppTeamName": "Fenerbahce", "teamPos": null, "fullTimeScore": "3:2", "halfTimeScore": "2:0", "fullTimeResult": "W", "firstHalfHad": "W"}, {"competitionName": "Greek Division 1", "kickOff": "2024-04-03 16:00:00", "homeOrAway": "H", "oppTeamName": "Aris Thessaloniki", "teamPos": 5, "fullTimeScore": "3:0", "halfTimeScore": "1:0", "fullTimeResult": "W", "firstHalfHad": "W"}, {"competitionName": "Greek Division 1", "kickOff": "2024-03-10 18:30:00", "homeOrAway": "H", "oppTeamName": "Panathinaikos", "teamPos": 4, "fullTimeScore": "1:3", "halfTimeScore": "1:2", "fullTimeResult": "L", "firstHalfHad": "L"}, {"competitionName": "UE Conference", "kickOff": "2024-03-07 17:45:00", "homeOrAway": "H", "oppTeamName": "Maccabi Tel Aviv", "teamPos": null, "fullTimeScore": "1:4", "halfTimeScore": "1:3", "fullTimeResult": "L", "firstHalfHad": "L"}], "awayTeam": [{"competitionName": "Italian Division 1", "kickOff": "2024-05-23 18:45:00", "homeOrAway": "A", "oppTeamName": "Cagliari", "teamPos": 15, "fullTimeScore": "3:2", "halfTimeScore": "1:0", "fullTimeResult": "W", "firstHalfHad": "W"}, {"competitionName": "UE Conference", "kickOff": "2024-05-08 16:45:00", "homeOrAway": "A", "oppTeamName": "Bruges", "teamPos": null, "fullTimeScore": "1:1", "halfTimeScore": "0:1", "fullTimeResult": "D", "firstHalfHad": "L"}, {"competitionName": "Italian Division 1", "kickOff": "2024-05-05 13:00:00", "homeOrAway": "A", "oppTeamName": "Verona", "teamPos": 15, "fullTimeScore": "1:2", "halfTimeScore": "1:1", "fullTimeResult": "L", "firstHalfHad": "D"}, {"competitionName": "Italian Cup", "kickOff": "2024-04-24 19:00:00", "homeOrAway": "A", "oppTeamName": "Atalanta", "teamPos": null, "fullTimeScore": "1:4", "halfTimeScore": "0:1", "fullTimeResult": "L", "firstHalfHad": "L"}, {"competitionName": "Italian Division 1", "kickOff": "2024-04-21 16:00:00", "homeOrAway": "A", "oppTeamName": "Salernitana", "teamPos": 20, "fullTimeScore": "2:0", "halfTimeScore": "0:0", "fullTimeResult": "W", "firstHalfHad": "D"}, {"competitionName": "UE Conference", "kickOff": "2024-04-11 16:45:00", "homeOrAway": "A", "oppTeamName": "Viktoria Plzen", "teamPos": null, "fullTimeScore": "0:0", "halfTimeScore": "0:0", "fullTimeResult": "D", "firstHalfHad": "D"}, {"competitionName": "Italian Division 1", "kickOff": "2024-04-07 18:45:00", "homeOrAway": "A", "oppTeamName": "Juventus", "teamPos": 3, "fullTimeScore": "0:1", "halfTimeScore": "0:1", "fullTimeResult": "L", "firstHalfHad": "L"}, {"competitionName": "UE Conference", "kickOff": "2024-03-07 20:00:00", "homeOrAway": "A", "oppTeamName": "Maccabi Haifa", "teamPos": null, "fullTimeScore": "4:3", "halfTimeScore": "1:2", "fullTimeResult": "W", "firstHalfHad": "L"}]}}

View File

@@ -0,0 +1 @@
{"recent8Results": {"homeTeam": [{"competitionName": "Greek Division 1", "kickOff": "2024-05-15 17:00:00", "homeOrAway": "H", "oppTeamName": "AEK Athens", "teamPos": 1, "fullTimeScore": "2:0", "halfTimeScore": "0:0", "fullTimeResult": "W", "firstHalfHad": "D"}, {"competitionName": "UE Conference", "kickOff": "2024-05-09 19:00:00", "homeOrAway": "H", "oppTeamName": "Aston Villa", "teamPos": null, "fullTimeScore": "2:0", "halfTimeScore": "1:0", "fullTimeResult": "W", "firstHalfHad": "W"}, {"competitionName": "Greek Division 1", "kickOff": "2024-04-28 14:00:00", "homeOrAway": "H", "oppTeamName": "Lamia", "teamPos": 9, "fullTimeScore": "4:1", "halfTimeScore": "2:0", "fullTimeResult": "W", "firstHalfHad": "W"}, {"competitionName": "Greek Division 1", "kickOff": "2024-04-21 17:30:00", "homeOrAway": "H", "oppTeamName": "PAOK", "teamPos": 3, "fullTimeScore": "2:1", "halfTimeScore": "1:0", "fullTimeResult": "W", "firstHalfHad": "W"}, {"competitionName": "UE Conference", "kickOff": "2024-04-11 16:45:00", "homeOrAway": "H", "oppTeamName": "Fenerbahce", "teamPos": null, "fullTimeScore": "3:2", "halfTimeScore": "2:0", "fullTimeResult": "W", "firstHalfHad": "W"}, {"competitionName": "Greek Division 1", "kickOff": "2024-04-03 16:00:00", "homeOrAway": "H", "oppTeamName": "Aris Thessaloniki", "teamPos": 5, "fullTimeScore": "3:0", "halfTimeScore": "1:0", "fullTimeResult": "W", "firstHalfHad": "W"}, {"competitionName": "Greek Division 1", "kickOff": "2024-03-10 18:30:00", "homeOrAway": "H", "oppTeamName": "Panathinaikos", "teamPos": 4, "fullTimeScore": "1:3", "halfTimeScore": "1:2", "fullTimeResult": "L", "firstHalfHad": "L"}, {"competitionName": "UE Conference", "kickOff": "2024-03-07 17:45:00", "homeOrAway": "H", "oppTeamName": "Maccabi Tel Aviv", "teamPos": null, "fullTimeScore": "1:4", "halfTimeScore": "1:3", "fullTimeResult": "L", "firstHalfHad": "L"}], "awayTeam": [{"competitionName": "Italian Division 1", "kickOff": "2024-05-23 18:45:00", "homeOrAway": "A", "oppTeamName": "Cagliari", "teamPos": 15, "fullTimeScore": "3:2", "halfTimeScore": "1:0", "fullTimeResult": "W", "firstHalfHad": "W"}, {"competitionName": "Italian Division 1", "kickOff": "2024-05-17 18:45:00", "homeOrAway": "H", "oppTeamName": "Napoli", "teamPos": 9, "fullTimeScore": "2:2", "halfTimeScore": "2:1", "fullTimeResult": "D", "firstHalfHad": "W"}, {"competitionName": "Italian Division 1", "kickOff": "2024-05-13 18:45:00", "homeOrAway": "H", "oppTeamName": "Monza", "teamPos": 12, "fullTimeScore": "2:1", "halfTimeScore": "1:1", "fullTimeResult": "W", "firstHalfHad": "D"}, {"competitionName": "UE Conference", "kickOff": "2024-05-08 16:45:00", "homeOrAway": "A", "oppTeamName": "Bruges", "teamPos": null, "fullTimeScore": "1:1", "halfTimeScore": "0:1", "fullTimeResult": "D", "firstHalfHad": "L"}, {"competitionName": "Italian Division 1", "kickOff": "2024-05-05 13:00:00", "homeOrAway": "A", "oppTeamName": "Verona", "teamPos": 15, "fullTimeScore": "1:2", "halfTimeScore": "1:1", "fullTimeResult": "L", "firstHalfHad": "D"}, {"competitionName": "UE Conference", "kickOff": "2024-05-02 19:00:00", "homeOrAway": "H", "oppTeamName": "Bruges", "teamPos": null, "fullTimeScore": "3:2", "halfTimeScore": "2:1", "fullTimeResult": "W", "firstHalfHad": "W"}, {"competitionName": "Italian Division 1", "kickOff": "2024-04-28 18:45:00", "homeOrAway": "H", "oppTeamName": "Sassuolo", "teamPos": 19, "fullTimeScore": "5:1", "halfTimeScore": "1:0", "fullTimeResult": "W", "firstHalfHad": "W"}, {"competitionName": "Italian Cup", "kickOff": "2024-04-24 19:00:00", "homeOrAway": "A", "oppTeamName": "Atalanta", "teamPos": null, "fullTimeScore": "1:4", "halfTimeScore": "0:1", "fullTimeResult": "L", "firstHalfHad": "L"}]}}

View File

@@ -0,0 +1 @@
{"recent8Results": {"homeTeam": [{"competitionName": "Greek Division 1", "kickOff": "2024-05-19 17:00:00", "homeOrAway": "A", "oppTeamName": "Panathinaikos", "teamPos": 4, "fullTimeScore": "2:2", "halfTimeScore": "0:1", "fullTimeResult": "D", "firstHalfHad": "L"}, {"competitionName": "Greek Division 1", "kickOff": "2024-05-15 17:00:00", "homeOrAway": "H", "oppTeamName": "AEK Athens", "teamPos": 1, "fullTimeScore": "2:0", "halfTimeScore": "0:0", "fullTimeResult": "W", "firstHalfHad": "D"}, {"competitionName": "Greek Division 1", "kickOff": "2024-05-12 17:00:00", "homeOrAway": "A", "oppTeamName": "PAOK", "teamPos": 3, "fullTimeScore": "0:2", "halfTimeScore": "0:1", "fullTimeResult": "L", "firstHalfHad": "L"}, {"competitionName": "UE Conference", "kickOff": "2024-05-09 19:00:00", "homeOrAway": "H", "oppTeamName": "Aston Villa", "teamPos": null, "fullTimeScore": "2:0", "halfTimeScore": "1:0", "fullTimeResult": "W", "firstHalfHad": "W"}, {"competitionName": "UE Conference", "kickOff": "2024-05-02 19:00:00", "homeOrAway": "A", "oppTeamName": "Aston Villa", "teamPos": null, "fullTimeScore": "4:2", "halfTimeScore": "2:1", "fullTimeResult": "W", "firstHalfHad": "W"}, {"competitionName": "Greek Division 1", "kickOff": "2024-04-28 14:00:00", "homeOrAway": "H", "oppTeamName": "Lamia", "teamPos": 9, "fullTimeScore": "4:1", "halfTimeScore": "2:0", "fullTimeResult": "W", "firstHalfHad": "W"}, {"competitionName": "Greek Division 1", "kickOff": "2024-04-24 16:30:00", "homeOrAway": "A", "oppTeamName": "Aris Thessaloniki", "teamPos": 5, "fullTimeScore": "1:1", "halfTimeScore": "0:0", "fullTimeResult": "D", "firstHalfHad": "D"}, {"competitionName": "Greek Division 1", "kickOff": "2024-04-21 17:30:00", "homeOrAway": "H", "oppTeamName": "PAOK", "teamPos": 3, "fullTimeScore": "2:1", "halfTimeScore": "1:0", "fullTimeResult": "W", "firstHalfHad": "W"}], "awayTeam": [{"competitionName": "Italian Division 1", "kickOff": "2024-05-23 18:45:00", "homeOrAway": "A", "oppTeamName": "Cagliari", "teamPos": 15, "fullTimeScore": "3:2", "halfTimeScore": "1:0", "fullTimeResult": "W", "firstHalfHad": "W"}, {"competitionName": "Italian Division 1", "kickOff": "2024-05-17 18:45:00", "homeOrAway": "H", "oppTeamName": "Napoli", "teamPos": 9, "fullTimeScore": "2:2", "halfTimeScore": "2:1", "fullTimeResult": "D", "firstHalfHad": "W"}, {"competitionName": "Italian Division 1", "kickOff": "2024-05-13 18:45:00", "homeOrAway": "H", "oppTeamName": "Monza", "teamPos": 12, "fullTimeScore": "2:1", "halfTimeScore": "1:1", "fullTimeResult": "W", "firstHalfHad": "D"}, {"competitionName": "UE Conference", "kickOff": "2024-05-08 16:45:00", "homeOrAway": "A", "oppTeamName": "Bruges", "teamPos": null, "fullTimeScore": "1:1", "halfTimeScore": "0:1", "fullTimeResult": "D", "firstHalfHad": "L"}, {"competitionName": "Italian Division 1", "kickOff": "2024-05-05 13:00:00", "homeOrAway": "A", "oppTeamName": "Verona", "teamPos": 15, "fullTimeScore": "1:2", "halfTimeScore": "1:1", "fullTimeResult": "L", "firstHalfHad": "D"}, {"competitionName": "UE Conference", "kickOff": "2024-05-02 19:00:00", "homeOrAway": "H", "oppTeamName": "Bruges", "teamPos": null, "fullTimeScore": "3:2", "halfTimeScore": "2:1", "fullTimeResult": "W", "firstHalfHad": "W"}, {"competitionName": "Italian Division 1", "kickOff": "2024-04-28 18:45:00", "homeOrAway": "H", "oppTeamName": "Sassuolo", "teamPos": 19, "fullTimeScore": "5:1", "halfTimeScore": "1:0", "fullTimeResult": "W", "firstHalfHad": "W"}, {"competitionName": "Italian Cup", "kickOff": "2024-04-24 19:00:00", "homeOrAway": "A", "oppTeamName": "Atalanta", "teamPos": null, "fullTimeScore": "1:4", "halfTimeScore": "0:1", "fullTimeResult": "L", "firstHalfHad": "L"}]}}

View File

@@ -0,0 +1 @@
{"info": {}, "displayname": [], "competitionName": "UE Conference", "lastUpdated": ""}

View File

@@ -0,0 +1,311 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "6405f0ad-a363-4d36-a808-6f778c7b8c65",
"metadata": {},
"source": [
"## 1. start here, run this cell"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "1a332d6f",
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "b5e83551f1084e628a2bcdcf87665185",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Dropdown(description='Select an option:', options=('2024-05-27,Finnish Division 1(芬蘭超級聯賽),Lahti(拉迪) vs SJK Sei…"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"import os,sys,json\n",
"from pprint import pprint\n",
"import nest_asyncio\n",
"import asyncio\n",
"import ipywidgets as widgets\n",
"\n",
"from api_footylogic_com.match.statistics.MarketsInfo import getMarketsInfoJson\n",
"from api_footylogic_com.match.h2h.RecentformInformation import getRecentformInformationJson\n",
"from api_footylogic_com.tournament.Standings import getStandingsJson\n",
"from api_footylogic_com.tournament.Competitions import getCompetitionsJson, lookupCompetitionId\n",
"from api_footylogic_com.match.h2h.Banner import getBannerJson, getTeams, getCompetitionName\n",
"from api_footylogic_com.match.seasonalstats.DropdownFilters import getDropdownFilters\n",
"from bet_hkjc_com.football.getJSON import getMatchesJson, getMatchesList\n",
"\n",
"from utils.Statistics import getTopBottomWinningAndLoseing\n",
"from utils.WriteExcel import writeExcel\n",
"from utils.GetScreenshot import getScreenshot\n",
"from utils.reports import genExcelReport\n",
"from utils.getDropdownMenu import genMatchList\n",
"\n",
"[options, matches_list] = genMatchList()\n",
"dropdown = widgets.Dropdown(options=options, description='Select an option:')\n",
"display(dropdown)"
]
},
{
"cell_type": "markdown",
"id": "b8309647-791d-4d6b-bb01-4c417c46b13c",
"metadata": {},
"source": [
"## 2. select matches and run below cell"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "98987f47-b2af-4932-9f8d-f0a47dca1c10",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"['50019599', '50026115']\n",
"generate report for 2024-03-23,Spanish Division 2(西班牙乙組聯賽),Alcorcon(艾高干) vs Oviedo(奧維多)\n"
]
}
],
"source": [
"# generate_report_key = dropdown.value\n",
"generate_report_key = '2024-03-23,Spanish Division 2(西班牙乙組聯賽),Alcorcon(艾高干) vs Oviedo(奧維多)'\n",
"\n",
"report_filename= generate_report_key.replace(',','_').replace(' ','_') +'.xlsx'\n",
"[tournamentID,matchID] = matches_list[generate_report_key]\n",
"pprint([tournamentID,matchID])\n",
"\n",
"# print('generate report for '+ generate_report_key)\n",
"print('generate report for '+ generate_report_key)"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "6a31f956-0ff4-4341-8549-8421da70ab04",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Banner.py: get banner json done\n",
"MarketsInfo.py: getMarketsInfoJson done\n",
"DropdownFilters.py: get getDropdownFilters json done\n",
"Options.py: get options done\n",
"Standings.py: get standings done\n",
"https://footylogic.com/en/matchcenter/0/50019599/50026115/bmstatistics\n",
"https://footylogic.com/en/matchcenter/0/50019599/50026115/bmrecentforms\n",
"https://footylogic.com/en/tournament/league/50019599/standings\n",
"/app/notebook/_images/bmstatistics.png\n",
"/app/notebook/_images/bmrecentforms.png\n",
"/app/notebook/_images/standings.png\n",
"reports.py: done...\n"
]
}
],
"source": [
"genExcelReport(tournamentID, matchID, report_filename)"
]
},
{
"cell_type": "markdown",
"id": "772987b4-0d77-4ed0-a396-b0b685608930",
"metadata": {},
"source": [
"## 3. grab the report in _output directory"
]
},
{
"cell_type": "markdown",
"id": "3c46d722-0715-4aaf-8b4f-d4163ad88742",
"metadata": {},
"source": [
"### end for phase one"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "4545183e-5e9d-4663-b0a3-08348d56a845",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"07:02:43.817861\n",
"2024-05-27,Finnish Division 1(芬蘭超級聯賽),Lahti(拉迪) vs SJK Seinajoki(施拿祖基)\n",
"working on 0/13 , 2024-05-27,Finnish Division 1(芬蘭超級聯賽),Lahti(拉迪) vs SJK Seinajoki(施拿祖基)\n",
"Banner.py: get banner json done\n",
"MarketsInfo.py: getMarketsInfoJson done\n",
"DropdownFilters.py: get getDropdownFilters json done\n",
"Options.py: get options done\n",
"2024-05-27,Finnish Division 1(芬蘭超級聯賽),VPS Vaasa(VPS華沙) vs Inter Turku(國際杜古)\n",
"working on 1/13 , 2024-05-27,Finnish Division 1(芬蘭超級聯賽),VPS Vaasa(VPS華沙) vs Inter Turku(國際杜古)\n",
"Banner.py: get banner json done\n",
"MarketsInfo.py: getMarketsInfoJson done\n",
"DropdownFilters.py: get getDropdownFilters json done\n",
"Options.py: get options done\n",
"2024-05-28,Swedish Division 1(瑞典超級聯賽),Norrkoping(諾高平) vs Varnamo(華納莫)\n",
"working on 2/13 , 2024-05-28,Swedish Division 1(瑞典超級聯賽),Norrkoping(諾高平) vs Varnamo(華納莫)\n",
"Banner.py: get banner json done\n",
"MarketsInfo.py: getMarketsInfoJson done\n",
"DropdownFilters.py: get getDropdownFilters json done\n",
"Options.py: get options done\n",
"Standings.py: get standings done\n",
"2024-05-28,Swedish Division 1(瑞典超級聯賽),AIK Solna(AIK蘇納) vs Goteborg(哥登堡)\n",
"working on 3/13 , 2024-05-28,Swedish Division 1(瑞典超級聯賽),AIK Solna(AIK蘇納) vs Goteborg(哥登堡)\n",
"Banner.py: get banner json done\n",
"MarketsInfo.py: getMarketsInfoJson done\n",
"DropdownFilters.py: get getDropdownFilters json done\n",
"Options.py: get options done\n",
"Standings.py: get standings done\n",
"https://footylogic.com/en/matchcenter/0/50027252/50029417/bmstatistics\n",
"https://footylogic.com/en/matchcenter/0/50027252/50029417/bmrecentforms\n",
"https://footylogic.com/en/tournament/league/50027252/standings\n",
"2024-05-28,German Division 1(德國甲組聯賽),Dusseldorf(杜塞爾多夫) vs Bochum(波琴)\n",
"working on 4/13 , 2024-05-28,German Division 1(德國甲組聯賽),Dusseldorf(杜塞爾多夫) vs Bochum(波琴)\n",
"Banner.py: get banner json done\n",
"MarketsInfo.py: getMarketsInfoJson done\n",
"DropdownFilters.py: get getDropdownFilters json done\n",
"Options.py: get options done\n",
"Standings.py: get standings done\n",
"https://footylogic.com/en/matchcenter/0/50016467/50029521/bmstatistics\n",
"https://footylogic.com/en/matchcenter/0/50016467/50029521/bmrecentforms\n",
"https://footylogic.com/en/tournament/league/50016467/standings\n",
"2024-05-28,Argentine Division 1(阿根廷甲組聯賽),Union Santa Fe(聖達菲聯) vs Barracas Central(巴拉卡斯中央)\n",
"working on 5/13 , 2024-05-28,Argentine Division 1(阿根廷甲組聯賽),Union Santa Fe(聖達菲聯) vs Barracas Central(巴拉卡斯中央)\n",
"Banner.py: get banner json done\n",
"MarketsInfo.py: getMarketsInfoJson done\n",
"DropdownFilters.py: get getDropdownFilters json done\n",
"Options.py: get options done\n",
"Standings.py: get standings done\n",
"https://footylogic.com/en/matchcenter/0/50029135/50029547/bmstatistics\n",
"https://footylogic.com/en/matchcenter/0/50029135/50029547/bmrecentforms\n",
"https://footylogic.com/en/tournament/league/50029135/standings\n",
"2024-05-28,Argentine Division 1(阿根廷甲組聯賽),Atletico Tucuman(圖庫曼體育會) vs CA Platense(CA普拉坦斯)\n",
"working on 6/13 , 2024-05-28,Argentine Division 1(阿根廷甲組聯賽),Atletico Tucuman(圖庫曼體育會) vs CA Platense(CA普拉坦斯)\n",
"Banner.py: get banner json done\n",
"MarketsInfo.py: getMarketsInfoJson done\n",
"DropdownFilters.py: get getDropdownFilters json done\n",
"Options.py: get options done\n",
"Standings.py: get standings done\n",
"https://footylogic.com/en/matchcenter/0/50029135/50029560/bmstatistics\n",
"https://footylogic.com/en/matchcenter/0/50029135/50029560/bmrecentforms\n",
"https://footylogic.com/en/tournament/league/50029135/standings\n",
"2024-05-28,Korean Division 1(南韓職業聯賽),Gimcheon Sangmu(金泉尚武) vs FC Seoul(FC首爾)\n",
"working on 7/13 , 2024-05-28,Korean Division 1(南韓職業聯賽),Gimcheon Sangmu(金泉尚武) vs FC Seoul(FC首爾)\n",
"Banner.py: get banner json done\n",
"MarketsInfo.py: getMarketsInfoJson done\n",
"DropdownFilters.py: get getDropdownFilters json done\n",
"Options.py: get options done\n",
"Standings.py: get standings done\n",
"https://footylogic.com/en/matchcenter/0/50026040/50029439/bmstatistics\n",
"https://footylogic.com/en/matchcenter/0/50026040/50029439/bmrecentforms\n",
"https://footylogic.com/en/tournament/league/50026040/standings\n",
"2024-05-28,Korean Division 1(南韓職業聯賽),Gwangju FC(FC光州) vs Pohang Steelers(浦項制鐵)\n",
"working on 8/13 , 2024-05-28,Korean Division 1(南韓職業聯賽),Gwangju FC(FC光州) vs Pohang Steelers(浦項制鐵)\n",
"Banner.py: get banner json done\n",
"MarketsInfo.py: getMarketsInfoJson done\n",
"DropdownFilters.py: get getDropdownFilters json done\n",
"Options.py: get options done\n",
"Standings.py: get standings done\n",
"https://footylogic.com/en/matchcenter/0/50026040/50029440/bmstatistics\n",
"https://footylogic.com/en/matchcenter/0/50026040/50029440/bmrecentforms\n",
"https://footylogic.com/en/tournament/league/50026040/standings\n",
"2024-05-29,German Division 2(德國乙組聯賽),Wehen(韋恩) vs Jahn Regensburg(雷根斯堡)\n",
"working on 9/13 , 2024-05-29,German Division 2(德國乙組聯賽),Wehen(韋恩) vs Jahn Regensburg(雷根斯堡)\n",
"Banner.py: get banner json done\n",
"MarketsInfo.py: getMarketsInfoJson done\n",
"DropdownFilters.py: get getDropdownFilters json done\n",
"Options.py: get options done\n",
"Standings.py: get standings done\n",
"https://footylogic.com/en/matchcenter/0/50016660/50029643/bmstatistics\n",
"https://footylogic.com/en/matchcenter/0/50016660/50029643/bmrecentforms\n",
"https://footylogic.com/en/tournament/league/50016660/standings\n",
"2024-05-29,Japanese Division 1(日本職業聯賽),Yokohama F.Marinos(橫濱水手) vs Kashiwa Reysol(柏雷素爾)\n",
"working on 10/13 , 2024-05-29,Japanese Division 1(日本職業聯賽),Yokohama F.Marinos(橫濱水手) vs Kashiwa Reysol(柏雷素爾)\n",
"Banner.py: get banner json done\n",
"MarketsInfo.py: getMarketsInfoJson done\n",
"DropdownFilters.py: get getDropdownFilters json done\n",
"Options.py: get options done\n",
"Standings.py: get standings done\n",
"https://footylogic.com/en/matchcenter/0/50025768/50029414/bmstatistics\n",
"https://footylogic.com/en/matchcenter/0/50025768/50029414/bmrecentforms\n",
"https://footylogic.com/en/tournament/league/50025768/standings\n",
"2024-05-30,UE Conference(歐洲協會聯賽),Olympiakos(奧林比亞高斯) vs Fiorentina(費倫天拿)\n",
"working on 11/13 , 2024-05-30,UE Conference(歐洲協會聯賽),Olympiakos(奧林比亞高斯) vs Fiorentina(費倫天拿)\n",
"Banner.py: get banner json done\n",
"MarketsInfo.py: getMarketsInfoJson done\n",
"DropdownFilters.py: get getDropdownFilters json done\n",
"Options.py: get options done\n",
"Standings.py: get standings done\n",
"2024-06-02,UE Champions(歐洲聯賽冠軍盃),Dortmund(多蒙特) vs Real Madrid(皇家馬德里)\n",
"07:03:09.214254\n"
]
}
],
"source": [
"from datetime import datetime\n",
"print(datetime.now().time())\n",
"\n",
"target_date = '2024-05'\n",
"\n",
"for i in range(0, len(options)):\n",
" try:\n",
" option = options[i]\n",
" print(option)\n",
" if (option.index(target_date) > -1):\n",
" print('working on '+str(i)+'/'+str(len(options))+' , '+option)\n",
" [tournamentID,matchID] = matches_list[option]\n",
" report_filename= option.replace(',','_').replace(' ','_') +'.xlsx'\n",
" genExcelReport(tournamentID, matchID, report_filename)\n",
" except Exception as e:\n",
" pass\n",
"\n",
"print(datetime.now().time())"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "8e1bb1c6-6b4b-4c4b-ad93-5192fdd7faf0",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.10"
}
},
"nbformat": 4,
"nbformat_minor": 5
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,64 @@
#!/usr/bin/env python
from playwright.async_api import async_playwright
def helloworld():
print("helloworld")
async def getScreenshot_bmstatistics(url, file_path, timeout_s):
async with async_playwright() as pw:
browser = await pw.chromium.launch(headless=True)
page = await browser.new_page()
await page.goto(url)
await page.wait_for_timeout(timeout_s * 1000)
# await page.waitForSelector('xpath=//*[contains(text(), "Total Goals")]');
await page.get_by_text("Total Goals").click()
await page.screenshot(path=file_path, full_page=True)
await browser.close()
async def getScreenshot_bmrecentforms(url, file_path, timeout_s):
async with async_playwright() as pw:
browser = await pw.chromium.launch(headless=True)
page = await browser.new_page()
await page.goto(url)
elements = await page.locator('select.select-margin').all()
with open('./result.txt','w') as fo:
fo.write(str(len(elements)))
await elements[0].select_option(label="Home Matches")
await elements[1].select_option(label="Away Matches")
await page.screenshot(path=file_path, full_page=True)
await browser.close()
async def getScreenshot_standings(url, file_path, timeout_s):
async with async_playwright() as pw:
browser = await pw.chromium.launch(headless=True)
page = await browser.new_page()
await page.goto(url)
await page.wait_for_timeout(timeout_s * 1000)
await page.screenshot(path=file_path, full_page=True)
await browser.close()
async def getScreenshot(url, file_path, timeout_s):
async with async_playwright() as pw:
browser = await pw.chromium.launch(headless=True)
page = await browser.new_page()
await page.goto(url)
await page.wait_for_timeout(timeout_s * 1000)
await page.screenshot(path=file_path, full_page=True)
await browser.close()

View File

@@ -0,0 +1,132 @@
#!/usr/bin/env python3
import os,sys,json
from pprint import pprint
def distillRecent8Results(json_manifest, competitionName="Belgian Division 1"):
# distill results
json_manifest['statistics']['distilledRecent8Results'] = {}
json_manifest_distilled = json_manifest['statistics']['distilledRecent8Results']
json_manifest_distilled['homeTeam'] = []
distilled_homeTeam = json_manifest_distilled['homeTeam']
json_manifest_distilled['awayTeam'] = []
distilled_awayTeam = json_manifest_distilled['awayTeam']
recent8Results = json_manifest['recentfrom-information.json']['recent8Results']
recent8ResultsHomeTeam = json_manifest['recentfrom-information-home-team.json']['recent8Results']
recent8ResultsAwayTeam = json_manifest['recentfrom-information-away-team.json']['recent8Results']
homeTeam = recent8ResultsHomeTeam['homeTeam']
for result in homeTeam:
if result['competitionName'] == competitionName and result['homeOrAway'] == "H":
if (len(distilled_homeTeam)) < 5:
distilled_homeTeam.append(result)
awayTeam = recent8ResultsAwayTeam['awayTeam']
for result in awayTeam:
if result['competitionName'] == competitionName and result['homeOrAway'] == "A":
if (len(distilled_awayTeam)) < 5:
distilled_awayTeam.append(result)
def lookupPositionByTeamName(json_manifest, teamNameToCheck):
standings_info = json_manifest['tournament/standings.json']['info']
for standing in standings_info:
if standing['teamName'] == teamNameToCheck:
return standing['teamRank']
raise Exception(teamNameToCheck)
return -99
def countTotalStandingTeam(json_manifest):
standings_info = json_manifest['tournament/standings.json']['info']
return len(standings_info)
def getTopBottomWinningAndLoseing(json_manifest, competitionName):
json_manifest['statistics'] = {}
json_manifest['statistics']['top_bottom_winning_losing'] = {}
result = json_manifest['statistics']['top_bottom_winning_losing']
# get statistics
result['home_top_win_count'] = 0
result['home_top_draw_count'] = 0
result['home_top_loss_count'] = 0
result['home_bottom_win_count'] = 0
result['home_bottom_draw_count'] = 0
result['home_bottom_loss_count'] = 0
result['away_top_win_count'] = 0
result['away_top_draw_count'] = 0
result['away_top_loss_count'] = 0
result['away_bottom_win_count'] = 0
result['away_bottom_draw_count'] = 0
result['away_bottom_loss_count'] = 0
# filter all non same tournament
distillRecent8Results(json_manifest, competitionName)
json_manifest_distilled = json_manifest['statistics']['distilledRecent8Results']
json_manifest_distilled_homeTeam = json_manifest_distilled['homeTeam']
json_manifest_distilled_awayTeam = json_manifest_distilled['awayTeam']
all_team_count = countTotalStandingTeam(json_manifest)
json_manifest_distilled['allTeamCount'] = all_team_count
for entry in json_manifest_distilled_homeTeam:
oppTeamName = entry['oppTeamName']
pos = lookupPositionByTeamName(json_manifest, oppTeamName)
pos = int(pos)
entry['pos'] = pos
if (pos <= (all_team_count / 2)):
# count home top winning
if entry['fullTimeResult'] == 'W':
result['home_top_win_count'] += 1
# count home top draw
if entry['fullTimeResult'] == 'D':
result['home_top_draw_count'] += 1
# count home top losing
if entry['fullTimeResult'] == 'L':
result['home_top_loss_count'] += 1
else:
# count home bottom winning
if entry['fullTimeResult'] == 'W':
result['home_bottom_win_count'] += 1
# count home bottom draw
if entry['fullTimeResult'] == 'D':
result['home_bottom_draw_count'] += 1
# count home bottom losing
if entry['fullTimeResult'] == 'L':
result['home_bottom_loss_count'] += 1
for entry in json_manifest_distilled_awayTeam:
oppTeamName = entry['oppTeamName']
pos = lookupPositionByTeamName(json_manifest, oppTeamName)
pos = int(pos)
entry['pos'] = pos
if (pos <= (all_team_count / 2)):
# count away top winning
if entry['fullTimeResult'] == 'W':
result['away_top_win_count'] += 1
# count away top draw
if entry['fullTimeResult'] == 'D':
result['away_top_draw_count'] += 1
# count away top losing
if entry['fullTimeResult'] == 'L':
result['away_top_loss_count'] += 1
else:
# count away bottom winning
if entry['fullTimeResult'] == 'W':
result['away_bottom_win_count'] += 1
# count away bottom draw
if entry['fullTimeResult'] == 'D':
result['away_bottom_draw_count'] += 1
# count away bottom losing
if entry['fullTimeResult'] == 'L':
result['away_bottom_loss_count'] += 1
def helloworld():
print("helloworld")

View File

@@ -0,0 +1,90 @@
#!/usr/bin/env python
import os
import sys
import re
from pprint import pprint
import json
from jsonpath_ng import jsonpath, parse
from openpyxl import Workbook, load_workbook
from openpyxl.utils import get_column_letter
from openpyxl.styles import Alignment
from openpyxl.drawing.image import Image
import re
def LookupTeamPosition(team_to_lookup, manifest_json):
team_rank = -99
num_of_team = -99
standings = manifest_json['tournament/standings.json']['info']
num_of_team = len(standings)
for standing in standings:
if standing['teamName'] == team_to_lookup:
team_rank = int(standing['teamRank'])
return [team_rank, num_of_team]
def writeExcel(json_manifest, image_paths, report_filename):
pattern = r"(?<={jp:)(.*)(?=})"
excel_template_path = '/report_template.xlsx'
os_cwd = os.getcwd()
utils_path = os_cwd+'/utils'
output_path = os_cwd + "/_output"
images_path = os_cwd + "/_images"
# Find and replace values
find_value = 'Mainz'
replace_value = '11111111'
# Create a new workbook
workbook = load_workbook(utils_path+excel_template_path)
# Select the active sheet (first sheet by default)
sheet = workbook.active
for row in sheet.iter_rows():
for cell in row:
# print(cell.coordinate)
if type(cell.value) == type('string'):
result = re.search(pattern, cell.value)
if result:
try:
jsonpath_expression = parse(result.group(0))
alignment = Alignment(
horizontal='center', vertical='center')
cell.alignment = alignment
cell.value = jsonpath_expression.find(json_manifest)[
0].value
except Exception as e:
pprint(e)
pprint("error:" + cell.value)
alignment = Alignment(
horizontal='center', vertical='center')
cell.alignment = alignment
cell.value = '---'
# image_path = images_path+"/helloworld.jpg"
current_cell = sheet.cell(row=1, column=9)
for image_path in image_paths:
print(image_path)
image = Image(image_path)
sheet.add_image(image, current_cell.coordinate)
current_cell = current_cell.offset(row=0, column=17)
workbook.save(output_path+'/'+report_filename)
def helloworld():
print(os.getcwd())
print("helloworld")

View File

@@ -0,0 +1,27 @@
#!
import os,sys
from api_footylogic_com.match.statistics.MarketsInfo import getMarketsInfoJson
from api_footylogic_com.match.h2h.RecentformInformation import getRecentformInformationJson
from api_footylogic_com.tournament.Standings import getStandingsJson
from api_footylogic_com.tournament.Competitions import getCompetitionsJson, lookupCompetitionId
from api_footylogic_com.match.h2h.Banner import getBannerJson, getTeams, getCompetitionName
from api_footylogic_com.match.seasonalstats.DropdownFilters import getDropdownFilters
from utils.Statistics import getTopBottomWinningAndLoseing
from utils.WriteExcel import writeExcel
from utils.GetScreenshot import getScreenshot
import nest_asyncio
import asyncio
import ipywidgets as widgets
from bet_hkjc_com.football.getJSON import getMatchesJson, getMatchesList
def genMatchList():
matches_json = getMatchesJson()
matches_list = getMatchesList(matches_json)
labels = []
for match_label in matches_list.keys():
labels.append(match_label)
return [labels, matches_list]

View File

@@ -0,0 +1,153 @@
#!/usr/bin/env python3
import os
import sys
import json
from pprint import pprint
from api_footylogic_com.match.statistics.MarketsInfo import getMarketsInfoJson
from api_footylogic_com.match.h2h.RecentformInformation import getRecentformInformationJson
from api_footylogic_com.match.h2h.RecentformInformationHomeTeam import getRecentformInformationHomeTeamJson
from api_footylogic_com.match.h2h.RecentformInformationAwayTeam import getRecentformInformationAwayTeamJson
from api_footylogic_com.tournament.Standings import getStandingsJson
from api_footylogic_com.tournament.Competitions import getCompetitionsJson, lookupCompetitionId
from api_footylogic_com.tournament.Options import getOptionsJson
from api_footylogic_com.match.h2h.Banner import getBannerJson, getTeams, getCompetitionName
from api_footylogic_com.match.seasonalstats.DropdownFilters import getDropdownFilters
from utils.Statistics import getTopBottomWinningAndLoseing
from utils.WriteExcel import writeExcel
from utils.GetScreenshot import getScreenshot, getScreenshot_bmstatistics, getScreenshot_bmrecentforms, getScreenshot_standings
import nest_asyncio
import asyncio
def genExcelReport(tournamentID='50022259', matchID='50024766', report_filename="report.xlsx"):
competitionId = tournamentID
eventId = matchID
# # extract
# # # banner.py
banner_json = getBannerJson(eventId)
[homeTeamId, awayTeamId] = getTeams(banner_json)
competitionName = getCompetitionName(banner_json)
# # # # 'https://footylogic.com/en/matchcenter/0/'+tournamentID+'/'+matchID+'/bmrecentforms'
# # match/h2h/RecentformInformation.py
getRecentformInformationJson(homeTeamId, awayTeamId)
getRecentformInformationHomeTeamJson(homeTeamId, awayTeamId)
getRecentformInformationAwayTeamJson(homeTeamId, awayTeamId)
# # MarketsInfo.py
getMarketsInfoJson(eventId, homeTeamId, awayTeamId, competitionId)
competitions_json = getCompetitionsJson()
# competitionId = lookupCompetitionId(competitions_json, competitionName)
lookupCompetitionId(competitions_json, competitionName)
dropdown_filters_json = getDropdownFilters(competitionId)
seasonId = dropdown_filters_json['Season'][0]['id']
options_json = getOptionsJson(competitionId, seasonId)
roundId = options_json[0]['id']
# https://api.footylogic.com/tournament/options?languageId=19&channelId=1&competitionId=50019599&seasonId=4456
standings_json = getStandingsJson(competitionId, seasonId, roundId)
# translate
json_manifest = {}
pattern = r"(?<={jp:)(.*)(?=})"
os_cwd = os.getcwd()
utils_path = os_cwd+'/utils'
excel_template_path = '/report_template.xlsx'
json_store_path = os_cwd+'/jsons'
output_path = os_cwd + "/_output"
images_path = os_cwd + "/_images"
markets_info_json_path = json_store_path+'/markets-info.json'
recentform_information_json_path = json_store_path+'/recentfrom-information.json'
recentform_information_home_team_json_path = json_store_path+'/recentfrom-information-home-team.json'
recentform_information_away_team_json_path = json_store_path+'/recentfrom-information-away-team.json'
recentform_information_json_path = json_store_path+'/recentfrom-information.json'
standings_json_path = json_store_path+'/standings.json'
banner_json_path = json_store_path+'/banner.json'
json_manifest_json_path = json_store_path+'/json_manifest.json'
with open(banner_json_path, 'r') as json_file:
banner_json = json.load(json_file)
json_manifest = {**json_manifest, 'banner_json': banner_json}
with open(markets_info_json_path, 'r') as json_file:
markets_info_json = json.load(json_file)
json_manifest = {**json_manifest,
'markets-info.json': markets_info_json}
# to be obsoleted
json_manifest = {**json_manifest, **markets_info_json}
with open(recentform_information_json_path, 'r') as json_file:
recentfrom_information_json = json.load(json_file)
json_manifest = {
**json_manifest, 'recentfrom-information.json': recentfrom_information_json}
# to be obsoleted
json_manifest = {**json_manifest, **recentfrom_information_json}
with open(recentform_information_home_team_json_path, 'r') as json_file:
recentfrom_information_json = json.load(json_file)
json_manifest = {
**json_manifest, 'recentfrom-information-home-team.json': recentfrom_information_json}
# to be obsoleted
json_manifest = {**json_manifest, **recentfrom_information_json}
with open(recentform_information_away_team_json_path, 'r') as json_file:
recentfrom_information_json = json.load(json_file)
json_manifest = {
**json_manifest, 'recentfrom-information-away-team.json': recentfrom_information_json}
# to be obsoleted
json_manifest = {**json_manifest, **recentfrom_information_json}
with open(standings_json_path, 'r') as json_file:
standings_json = json.load(json_file)
json_manifest = {**json_manifest,
'tournament/standings.json': standings_json}
with open(json_manifest_json_path, 'w+') as f_out:
f_out.truncate(0)
json.dump(json_manifest, f_out)
# get top/bottom winning and loseingreport_filename
getTopBottomWinningAndLoseing(json_manifest, competitionName)
# get screenshot
nest_asyncio.apply()
bms_url = 'https://footylogic.com/en/matchcenter/0/' + tournamentID+'/'+ matchID +'/bmstatistics'
bm_recent = 'https://footylogic.com/en/matchcenter/0/' + tournamentID+'/'+ matchID +'/bmrecentforms'
standings_url = 'https://footylogic.com/en/tournament/league/' + tournamentID +'/standings'
print(bms_url)
print(bm_recent)
print(standings_url)
asyncio.run(getScreenshot_bmstatistics(bms_url, images_path+'/bmstatistics.png', 1))
asyncio.run(getScreenshot_bmrecentforms(bm_recent, images_path+'/bmrecentforms.png', 1))
asyncio.run(getScreenshot_standings(standings_url, images_path+'/standings.png', 1))
# load
writeExcel(json_manifest, [
images_path+'/bmstatistics.png',
images_path+'/bmrecentforms.png',
images_path+'/standings.png',
], report_filename)
print('reports.py: done...')
def helloworld():
print("helloworld")

View File

@@ -0,0 +1,7 @@
jsonpath_ng==1.6.1
openpyxl==3.1.2
pillow==10.2.0
jupyter==1.0.0
playwright==1.41.0
ipywidgets==8.1.1
nest_asyncio==1.6.0

View File

@@ -0,0 +1,13 @@
#!/usr/bin/env bash
set -ex
docker run -it \
-v $PWD:/app \
-w /app \
-p 3000:3000 \
-p 8888:8888 \
-u 1000:1000 \
--rm \
logickee/ych1990101_jupyter:latest \
bash