This commit is contained in:
louiscklaw
2025-02-01 02:11:30 +08:00
parent 3de8aea20a
commit 692b9102dd
114 changed files with 7617 additions and 0 deletions

7
gitUpdate.bat Normal file
View File

@@ -0,0 +1,7 @@
git status .
@pause
git add .
git commit -m"update ych1990101,"
start git push

12
jsonpath-tryout/Pipfile Normal file
View File

@@ -0,0 +1,12 @@
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"
[packages]
jsonpath-ng = "*"
[dev-packages]
[requires]
python_version = "3.11"

36
jsonpath-tryout/Pipfile.lock generated Normal file
View File

@@ -0,0 +1,36 @@
{
"_meta": {
"hash": {
"sha256": "13e6ab508682901d9f54650d3c3fdbe343987158f038299e9b7b6f7480f0acae"
},
"pipfile-spec": 6,
"requires": {
"python_version": "3.11"
},
"sources": [
{
"name": "pypi",
"url": "https://pypi.org/simple",
"verify_ssl": true
}
]
},
"default": {
"jsonpath-ng": {
"hashes": [
"sha256:086c37ba4917304850bd837aeab806670224d3f038fe2833ff593a672ef0a5fa",
"sha256:8f22cd8273d7772eea9aaa84d922e0841aa36fdb8a2c6b7f6c3791a16a9bc0be"
],
"index": "pypi",
"version": "==1.6.1"
},
"ply": {
"hashes": [
"sha256:00c7c1aaa88358b9c765b6d3000c6eec0ba42abca5351b095321aef446081da3",
"sha256:096f9b8350b65ebd2fd1346b12452efe5b9607f7482813ffca50c22722a807ce"
],
"version": "==3.11"
}
},
"develop": {}
}

1174
jsonpath-tryout/db.json Normal file

File diff suppressed because it is too large Load Diff

12
jsonpath-tryout/main.py Normal file
View File

@@ -0,0 +1,12 @@
import json
from jsonpath_ng import jsonpath, parse
with open("db.json", 'r') as json_file:
json_data = json.load(json_file)
# print(json_data)
jsonpath_expression = parse('leagueTable.homeTeam.all.teamPlayed')
for match in jsonpath_expression.find(json_data):
print(f'Employee id: {match.value}')

62
meta.md Normal file
View File

@@ -0,0 +1,62 @@
---
tags: [jupyter, python, 馬會, excel, jsonpath, prompt]
---
# ych1990101
馬會:
https://footylogic.com/en/matchcenter
你好, 我想搵人代寫 python code.
個軟件程式係當 user 輸入
個軟件會去個特定網站, screen capture 個畫面.
從畫面中 Extract 一些需要的數字, 存取在一個已定好格式的 Excel File format.
[[ych1990101/task1/meta]]
[[ych1990101/task2/meta]]
[[ych1990101/task3/meta]]
[//begin]: # "Autogenerated link references for markdown compatibility"
[ych1990101/task1/meta]: task1/meta.md "task1"
[ych1990101/task2/meta]: task2/meta.md "task2"
[ych1990101/task3/meta]: task3/meta.md "task3"
[//end]: # "Autogenerated link references"
### history
HKD 1500
https://bet.hkjc.com/football/odds/odds_hil.aspx?lang=en
```
阿根廷甲組聯賽
西班牙甲組聯賽
西班牙乙組聯賽
蘇格蘭超級聯賽
葡萄牙超級聯賽
荷蘭甲組聯賽
荷蘭乙組聯賽
英格蘭超級聯賽
英格蘭冠軍聯賽
美國職業聯賽
瑞典超級聯賽
澳洲職業聯賽
法國甲組聯賽
法國乙組聯賽
智利甲組聯賽
日本職業聯賽
日本乙組聯賽
挪威超級聯賽
意大利甲組聯賽
德國甲組聯賽
德國乙組聯賽
南韓職業聯賽
```
[//begin]: # "Autogenerated link references for markdown compatibility"
[ych1990101/task1/meta]: task1/meta.md "task1"
[ych1990101/task2/meta]: task2/meta.md "task2"
[ych1990101/task3/meta]: task3/meta.md "task3"
[//end]: # "Autogenerated link references"

13
package.json Normal file
View File

@@ -0,0 +1,13 @@
{
"name": "ych1990101",
"version": "1.0.0",
"description": "HKD 1500",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"gitUpdate": "git add . && git commit -m\"update,\""
},
"keywords": [],
"author": "",
"license": "ISC"
}

27
task1-optimized/README.md Normal file
View File

@@ -0,0 +1,27 @@
# README
```bash
> ./rebuild.bat
vagrant ssh
# 001 setup run by vagrant file
./001_setup.sh
# 002 setup run by user
cd /app
./002_setup.sh
# 003 setup run by user
cd /app
./003_setup.sh
# 004 logout -> login
./dev.sh
# 1. setup requirements
# 2. setup playwright
# 3. start jupyter
```

31
task1-optimized/Vagrantfile vendored Normal file
View File

@@ -0,0 +1,31 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/focal64"
config.vm.provider "virtualbox" do |vb|
vb.name = "linux-helloworld"
vb.cpus = 2
vb.memory = "2048"
end
config.vm.network "forwarded_port", guest: 8888, host: 18888
# # install python
# config.vm.provision "shell", inline: <<-SHELL
# sudo apt-get update
# sudo apt-get install python3-pip -y
# sudo ln -s /usr/bin/python3 /usr/bin/python
# SHELL
# install docker
# config.vm.provision "shell", path: "./build_scripts/install_docker.sh"
# config.vm.provision "shell", path: "./build_scripts/install_docker.sh"
# user application
config.vm.synced_folder "./app", "/app"
config.vm.provision "shell", path: "./app/001_setup.sh"
end

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

BIN
task1-optimized/app/notebook/_images/bmrecentforms.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
task1-optimized/app/notebook/_images/bmstatistics.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
task1-optimized/app/notebook/_images/standings.png (Stored with Git LFS) Normal file

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

View File

@@ -0,0 +1,9 @@
#!/usr/bin/env bash
set -x
echo "# from fedora_bootstrap.sh" >> /etc/dnf/dnf.conf
echo "max_parallel_downloads=10" >> /etc/dnf/dnf.conf
echo "fastestmirror=True" >> /etc/dnf/dnf.conf
sudo dnf update -y && sudo dnf upgrade -y

View File

@@ -0,0 +1,39 @@
#!/usr/bin/env bash
set -x
# Run the following command to uninstall all conflicting packages:
for pkg in docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc; do
sudo apt-get remove $pkg;
done
# Add Docker's official GPG key:
sudo apt-get update -y
sudo apt-get -y install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
# Add the repository to Apt sources:
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update -y
# To install the latest version, run:
sudo apt-get -y install docker-ce \
docker-ce-cli \
containerd.io \
docker-buildx-plugin \
docker-compose-plugin
sudo docker run hello-world
sudo usermod -aG docker vagrant
sudo usermod -aG dialout vagrant
sudo systemctl enable docker
echo "install done"

9
task1-optimized/init.bat Normal file
View File

@@ -0,0 +1,9 @@
vagrant init hashicorp/bionic64
vagrant box add hashicorp/bionic64
vagrant up
vagrant ssh
vagrant destroy
vagrant box list
vagrant box remove hashicorp/bionic64
vagrant plugin install vagrant-share
vagrant share

View File

@@ -0,0 +1,10 @@
vagrant destroy -f
echo "build start"
vagrant up
@REM vagrant plugin install vagrant-share
echo "build done"
vagrant ssh

17
task1/meta.md Normal file
View File

@@ -0,0 +1,17 @@
---
tags: [virtualbox, vm, python, jupyter]
---
# task1
馬會:
https://footylogic.com/en/matchcenter
你好, 我想搵人代寫 python code.
個軟件程式係當 user 輸入
個軟件會去個特定網站, screen capture 個畫面.
從畫面中 Extract 一些需要的數字, 存取在一個已定好格式的 Excel File format.
[./ych1990101/task1/meta.md](./ych1990101/task1/meta.md)

194
task1/src/.gitignore vendored Normal file
View File

@@ -0,0 +1,194 @@
**/__pycache__/
**/notebook/jsons/*.json
**/notebook/bet_hkjc_com/**/*.json
**/notebook/*.json
_images
**/_output/*.xlsx
# Created by https://www.toptal.com/developers/gitignore/api/python,jupyternotebooks
# Edit at https://www.toptal.com/developers/gitignore?templates=python,jupyternotebooks
### JupyterNotebooks ###
# gitignore template for Jupyter Notebooks
# website: http://jupyter.org/
.ipynb_checkpoints
*/.ipynb_checkpoints/*
# IPython
profile_default/
ipython_config.py
# Remove previous ipynb_checkpoints
# git rm -r .ipynb_checkpoints/
### Python ###
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
.pybuilder/
target/
# Jupyter Notebook
# IPython
# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version
# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock
# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock
# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/
# Celery stuff
celerybeat-schedule
celerybeat.pid
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
.dmypy.json
dmypy.json
# Pyre type checker
.pyre/
# pytype static type analyzer
.pytype/
# Cython debug symbols
cython_debug/
# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
### Python Patch ###
# Poetry local configuration file - https://python-poetry.org/docs/configuration/#local-configuration
poetry.toml
# ruff
.ruff_cache/
# LSP config files
pyrightconfig.json
# End of https://www.toptal.com/developers/gitignore/api/python,jupyternotebooks

34
task1/src/Dockerfile Normal file
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

34
task1/src/README.md Normal file
View File

@@ -0,0 +1,34 @@
# README
```bash
$ ./start_docker.bat
# inside container
$ ./run.sh
```
阿根廷甲組聯賽
西班牙甲組聯賽
西班牙乙組聯賽
蘇格蘭超級聯賽
葡萄牙超級聯賽
荷蘭甲組聯賽
荷蘭乙組聯賽
英格蘭超級聯賽
英格蘭冠軍聯賽
美國職業聯賽
瑞典超級聯賽
澳洲職業聯賽
法國甲組聯賽
法國乙組聯賽
智利甲組聯賽
日本職業聯賽
日本乙組聯賽
挪威超級聯賽
意大利甲組聯賽
德國甲組聯賽
德國乙組聯賽
南韓職業聯賽

Binary file not shown.

1
task1/src/build.bat Normal file
View File

@@ -0,0 +1 @@
docker build . -t logickee/ych1990101_jupyter:latest

5
task1/src/build.sh Normal file
View File

@@ -0,0 +1,5 @@
#!/usr/bin/env bash
set -x
docker build . -t logickee/ych1990101_jupyter:latest

20
task1/src/dev.sh Normal file
View File

@@ -0,0 +1,20 @@
#!/usr/bin/env bash
set -x
# # pip install jupyter
# # pip install ipywidgets
# # pip install playwright
# # pip install nest_asyncio
pip install -r requirements.txt
playwright install
# playwright install-deps
jupyter notebook \
--allow-root \
--ip=0.0.0.0 \
--NotebookApp.token='' \
--NotebookApp.password='' \
--notebook-dir=notebook

View File

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

View File

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

View File

View File

@@ -0,0 +1,485 @@
{
"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": "ebee0d2271684c0d834cf17cc912376c",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Dropdown(description='Select an option:', options=('2024-03-24,Japanese Division 2(日本乙組聯賽),V-Varen Nagasaki(長崎…"
]
},
"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": 6,
"id": "4545183e-5e9d-4663-b0a3-08348d56a845",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"05:17:02.595649\n",
"2024-03-24,Japanese Division 2(日本乙組聯賽),V-Varen Nagasaki(長崎成功丸) vs Ventforet Kofu(甲府風林)\n",
"working on 0/26 , 2024-03-24,Japanese Division 2(日本乙組聯賽),V-Varen Nagasaki(長崎成功丸) vs Ventforet Kofu(甲府風林)\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-03-24,Japanese Division 2(日本乙組聯賽),Vegalta Sendai(仙台維加泰) vs Tokushima Vortis(德島漩渦)\n",
"working on 1/26 , 2024-03-24,Japanese Division 2(日本乙組聯賽),Vegalta Sendai(仙台維加泰) vs Tokushima Vortis(德島漩渦)\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-03-24,Korean FA Cup(南韓足總盃),Jeonnam Dragons(全南天龍) vs Gangneung Citizen(江陵市民)\n",
"working on 2/26 , 2024-03-24,Korean FA Cup(南韓足總盃),Jeonnam Dragons(全南天龍) vs Gangneung Citizen(江陵市民)\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-03-24,Japanese Division 2(日本乙組聯賽),Thespakusatsu Gunma(群馬草津溫泉) vs Fagiano Okayama(岡山綠雉)\n",
"working on 3/26 , 2024-03-24,Japanese Division 2(日本乙組聯賽),Thespakusatsu Gunma(群馬草津溫泉) vs Fagiano Okayama(岡山綠雉)\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-03-24,Spanish Division 2(西班牙乙組聯賽),Amorebieta(阿莫列比達) vs Gijon(希杭)\n",
"working on 4/26 , 2024-03-24,Spanish Division 2(西班牙乙組聯賽),Amorebieta(阿莫列比達) vs Gijon(希杭)\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/50019599/50026117/bmstatistics\n",
"https://footylogic.com/en/matchcenter/0/50019599/50026117/bmrecentforms\n",
"https://footylogic.com/en/tournament/league/50019599/standings\n",
"2024-03-24,Spanish Division 2(西班牙乙組聯賽),Huesca(侯爾斯卡) vs Burgos(貝高斯)\n",
"working on 5/26 , 2024-03-24,Spanish Division 2(西班牙乙組聯賽),Huesca(侯爾斯卡) vs Burgos(貝高斯)\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/50019599/50026111/bmstatistics\n",
"https://footylogic.com/en/matchcenter/0/50019599/50026111/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",
"2024-03-24,Spanish Division 2(西班牙乙組聯賽),Valladolid(華拉度列) vs Eibar(伊巴)\n",
"working on 6/26 , 2024-03-24,Spanish Division 2(西班牙乙組聯賽),Valladolid(華拉度列) vs Eibar(伊巴)\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/50019599/50026110/bmstatistics\n",
"https://footylogic.com/en/matchcenter/0/50019599/50026110/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",
"2024-03-25,Spanish Division 2(西班牙乙組聯賽),Levante(利雲特) vs CF Elche(艾爾切)\n",
"working on 7/26 , 2024-03-25,Spanish Division 2(西班牙乙組聯賽),Levante(利雲特) vs CF Elche(艾爾切)\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/50019599/50026116/bmstatistics\n",
"https://footylogic.com/en/matchcenter/0/50019599/50026116/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",
"2024-03-25,Spanish Division 2(西班牙乙組聯賽),Mirandes(米蘭迪斯) vs Zaragoza(薩拉戈薩)\n",
"working on 8/26 , 2024-03-25,Spanish Division 2(西班牙乙組聯賽),Mirandes(米蘭迪斯) vs Zaragoza(薩拉戈薩)\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/50019599/50026119/bmstatistics\n",
"https://footylogic.com/en/matchcenter/0/50019599/50026119/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",
"2024-03-25,International Matches(國際賽),Italy(意大利) vs Ecuador(厄瓜多爾)\n",
"working on 9/26 , 2024-03-25,International Matches(國際賽),Italy(意大利) vs Ecuador(厄瓜多爾)\n",
"Banner.py: get banner json done\n",
"MarketsInfo.py: getMarketsInfoJson done\n",
"DropdownFilters.py: get getDropdownFilters json done\n",
"2024-03-25,Spanish Division 2(西班牙乙組聯賽),Santander(桑坦德) vs CD Eldense(CD艾丹斯)\n",
"working on 10/26 , 2024-03-25,Spanish Division 2(西班牙乙組聯賽),Santander(桑坦德) vs CD Eldense(CD艾丹斯)\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/50019599/50026112/bmstatistics\n",
"https://footylogic.com/en/matchcenter/0/50019599/50026112/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",
"2024-03-25,International Matches(國際賽),Jamaica(牙買加) vs Panama(巴拿馬)\n",
"working on 11/26 , 2024-03-25,International Matches(國際賽),Jamaica(牙買加) vs Panama(巴拿馬)\n",
"Banner.py: get banner json done\n",
"2024-03-25,International Matches(國際賽),Guatemala(危地馬拉) vs Venezuela(委內瑞拉)\n",
"working on 12/26 , 2024-03-25,International Matches(國際賽),Guatemala(危地馬拉) vs Venezuela(委內瑞拉)\n",
"Banner.py: get banner json done\n",
"MarketsInfo.py: getMarketsInfoJson done\n",
"DropdownFilters.py: get getDropdownFilters json done\n",
"2024-03-25,International Matches(國際賽),USA(美國) vs Mexico(墨西哥)\n",
"working on 13/26 , 2024-03-25,International Matches(國際賽),USA(美國) vs Mexico(墨西哥)\n",
"Banner.py: get banner json done\n",
"2024-03-26,Spanish Division 2(西班牙乙組聯賽),Albacete(阿爾巴塞特) vs Racing de Ferrol(費路爾競賽)\n",
"working on 14/26 , 2024-03-26,Spanish Division 2(西班牙乙組聯賽),Albacete(阿爾巴塞特) vs Racing de Ferrol(費路爾競賽)\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/50019599/50026118/bmstatistics\n",
"https://footylogic.com/en/matchcenter/0/50019599/50026118/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",
"2024-03-26,Chilean Division 1(智利甲組聯賽),Universidad Chile(智利大學) vs Cobresal(科布雷素)\n",
"working on 15/26 , 2024-03-26,Chilean Division 1(智利甲組聯賽),Universidad Chile(智利大學) vs Cobresal(科布雷素)\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-03-30,Eng Premier(英格蘭超級聯賽),Newcastle(紐卡素) vs West Ham(韋斯咸)\n",
"working on 16/26 , 2024-03-30,Eng Premier(英格蘭超級聯賽),Newcastle(紐卡素) vs West Ham(韋斯咸)\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/50015668/50025367/bmstatistics\n",
"https://footylogic.com/en/matchcenter/0/50015668/50025367/bmrecentforms\n",
"https://footylogic.com/en/tournament/league/50015668/standings\n",
"2024-03-30,Eng Premier(英格蘭超級聯賽),Chelsea(車路士) vs Burnley(般尼)\n",
"working on 17/26 , 2024-03-30,Eng Premier(英格蘭超級聯賽),Chelsea(車路士) vs Burnley(般尼)\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/50015668/50026779/bmstatistics\n",
"https://footylogic.com/en/matchcenter/0/50015668/50026779/bmrecentforms\n",
"https://footylogic.com/en/tournament/league/50015668/standings\n",
"2024-03-30,Eng Premier(英格蘭超級聯賽),Tottenham(熱刺) vs Luton(盧頓)\n",
"working on 18/26 , 2024-03-30,Eng Premier(英格蘭超級聯賽),Tottenham(熱刺) vs Luton(盧頓)\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/50015668/50026607/bmstatistics\n",
"https://footylogic.com/en/matchcenter/0/50015668/50026607/bmrecentforms\n",
"https://footylogic.com/en/tournament/league/50015668/standings\n",
"/app/notebook/_images/bmstatistics.png\n",
"/app/notebook/_images/bmrecentforms.png\n",
"/app/notebook/_images/standings.png\n",
"reports.py: done...\n",
"2024-03-30,Eng Premier(英格蘭超級聯賽),Bournemouth(般尼茅夫) vs Everton(愛華頓)\n",
"working on 19/26 , 2024-03-30,Eng Premier(英格蘭超級聯賽),Bournemouth(般尼茅夫) vs Everton(愛華頓)\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/50015668/50026614/bmstatistics\n",
"https://footylogic.com/en/matchcenter/0/50015668/50026614/bmrecentforms\n",
"https://footylogic.com/en/tournament/league/50015668/standings\n",
"/app/notebook/_images/bmstatistics.png\n",
"/app/notebook/_images/bmrecentforms.png\n",
"/app/notebook/_images/standings.png\n",
"reports.py: done...\n",
"2024-03-30,Eng Premier(英格蘭超級聯賽),Nottingham Forest(諾定咸森林) vs Crystal Palace(水晶宮)\n",
"working on 20/26 , 2024-03-30,Eng Premier(英格蘭超級聯賽),Nottingham Forest(諾定咸森林) vs Crystal Palace(水晶宮)\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/50015668/50026778/bmstatistics\n",
"https://footylogic.com/en/matchcenter/0/50015668/50026778/bmrecentforms\n",
"https://footylogic.com/en/tournament/league/50015668/standings\n",
"/app/notebook/_images/bmstatistics.png\n",
"/app/notebook/_images/bmrecentforms.png\n",
"/app/notebook/_images/standings.png\n",
"reports.py: done...\n",
"2024-03-30,Eng Premier(英格蘭超級聯賽),Sheff Utd(錫菲聯) vs Fulham(富咸)\n",
"working on 21/26 , 2024-03-30,Eng Premier(英格蘭超級聯賽),Sheff Utd(錫菲聯) vs Fulham(富咸)\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/50015668/50026613/bmstatistics\n",
"https://footylogic.com/en/matchcenter/0/50015668/50026613/bmrecentforms\n",
"https://footylogic.com/en/tournament/league/50015668/standings\n",
"/app/notebook/_images/bmstatistics.png\n",
"/app/notebook/_images/bmrecentforms.png\n",
"/app/notebook/_images/standings.png\n",
"reports.py: done...\n",
"2024-03-31,Eng Premier(英格蘭超級聯賽),Aston Villa(阿士東維拉) vs Wolves(狼隊)\n",
"working on 22/26 , 2024-03-31,Eng Premier(英格蘭超級聯賽),Aston Villa(阿士東維拉) vs Wolves(狼隊)\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/50015668/50025366/bmstatistics\n",
"https://footylogic.com/en/matchcenter/0/50015668/50025366/bmrecentforms\n",
"https://footylogic.com/en/tournament/league/50015668/standings\n",
"/app/notebook/_images/bmstatistics.png\n",
"/app/notebook/_images/bmrecentforms.png\n",
"/app/notebook/_images/standings.png\n",
"reports.py: done...\n",
"2024-03-31,Eng Premier(英格蘭超級聯賽),Brentford(賓福特) vs Manchester Utd(曼聯)\n",
"working on 23/26 , 2024-03-31,Eng Premier(英格蘭超級聯賽),Brentford(賓福特) vs Manchester Utd(曼聯)\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/50015668/50025368/bmstatistics\n",
"https://footylogic.com/en/matchcenter/0/50015668/50025368/bmrecentforms\n",
"https://footylogic.com/en/tournament/league/50015668/standings\n",
"2024-03-31,Eng Premier(英格蘭超級聯賽),Liverpool(利物浦) vs Brighton(白禮頓)\n",
"working on 24/26 , 2024-03-31,Eng Premier(英格蘭超級聯賽),Liverpool(利物浦) vs Brighton(白禮頓)\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/50015668/50025370/bmstatistics\n",
"https://footylogic.com/en/matchcenter/0/50015668/50025370/bmrecentforms\n",
"https://footylogic.com/en/tournament/league/50015668/standings\n",
"IndexError('list index out of range')\n",
"'error:{jp:statistics.distilledRecent8Results.homeTeam[4].pos}'\n",
"IndexError('list index out of range')\n",
"'error:{jp:statistics.distilledRecent8Results.homeTeam[4].fullTimeScore}'\n",
"IndexError('list index out of range')\n",
"'error:{jp:statistics.distilledRecent8Results.awayTeam[4].pos}'\n",
"IndexError('list index out of range')\n",
"'error:{jp:statistics.distilledRecent8Results.awayTeam[4].fullTimeScore}'\n",
"/app/notebook/_images/bmstatistics.png\n",
"/app/notebook/_images/bmrecentforms.png\n",
"/app/notebook/_images/standings.png\n",
"reports.py: done...\n",
"2024-03-31,Eng Premier(英格蘭超級聯賽),Manchester City(曼城) vs Arsenal(阿仙奴)\n",
"working on 25/26 , 2024-03-31,Eng Premier(英格蘭超級聯賽),Manchester City(曼城) vs Arsenal(阿仙奴)\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/50015668/50025369/bmstatistics\n",
"https://footylogic.com/en/matchcenter/0/50015668/50025369/bmrecentforms\n",
"https://footylogic.com/en/tournament/league/50015668/standings\n",
"/app/notebook/_images/bmstatistics.png\n",
"/app/notebook/_images/bmrecentforms.png\n",
"/app/notebook/_images/standings.png\n",
"reports.py: done...\n",
"05:19:52.123568\n"
]
}
],
"source": [
"from datetime import datetime\n",
"print(datetime.now().time())\n",
"\n",
"target_date = '2024-03'\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.12.2"
}
},
"nbformat": 4,
"nbformat_minor": 5
}

View File

@@ -0,0 +1 @@
2

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]

Binary file not shown.

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")

Binary file not shown.

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

15
task1/src/run.sh Normal file
View File

@@ -0,0 +1,15 @@
#!/usr/bin/env bash
set -x
pip install playwright
pip install -r requirements.txt &
playwright install &
wait
jupyter notebook \
--allow-root \
--ip=0.0.0.0 \
--notebook-dir=notebook

View File

@@ -0,0 +1 @@
docker run -it -v .:/app -w /app -p 3000:3000 -p 8888:8888 -u 1000:1000 --rm logickee/ych1990101_jupyter:latest bash

13
task1/src/start_docker.sh Normal file
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

View File

@@ -0,0 +1 @@
{"eventId": "50024766", "homeTeamLogo": 13307, "awayTeamLogo": 10939, "homeTeamName": "Union Saint Gilloise", "awayTeamName": "Anderlecht", "competitionName": "Belgian Cup", "kickOffTime": "2024-01-25 19:30:00", "homeOdds": 1.68, "awayOdds": 3.95, "drawOdds": 3.5, "homeTeamId": 50003201, "homeTeamIdNav": 50003201, "awayTeamId": 50000175, "awayTeamIdNav": 50000175, "matchNumber": null, "homeTeamPos": "1", "awayTeamPos": "2", "matchDayCode": "FB0744", "competitionId": 50022259, "tournamentType": "League", "homePlayerAnalysis": 2, "awayPlayerAnalysis": 2, "homeLeagueShortName": "BEL L1", "awayLeagueShortName": "BEL L1", "competitionIdNav": 50022259}

View File

@@ -0,0 +1,497 @@
[
{
"categoryId": 10227,
"categoryName": "England",
"categoryImg": "england",
"competitions": [
{
"competitionId": 50015668,
"competitionName": "Eng Premier",
"standing_table_link": "https://footylogic.com/en/tournament/league/50015668/standings"
},
{
"competitionId": 50016923,
"competitionName": "Eng Championship",
"standing_table_link": "https://footylogic.com/en/tournament/league/50016923/standings"
},
{
"competitionId": 50016924,
"competitionName": "Eng League 1",
"standing_table_link": "https://footylogic.com/en/tournament/league/50016924/standings"
},
{
"competitionId": 50016925,
"competitionName": "Eng League 2",
"standing_table_link": "https://footylogic.com/en/tournament/league/50016925/standings"
},
{
"competitionId": 50022578,
"competitionName": "FA Cup",
"standing_table_link": "https://footylogic.com/en/tournament/league/50022578/standings"
},
{
"competitionId": 50018849,
"competitionName": "Eng League Cup",
"standing_table_link": "https://footylogic.com/en/tournament/league/50018849/standings"
},
{
"competitionId": 50020336,
"competitionName": "Eng League Trophy",
"standing_table_link": "https://footylogic.com/en/tournament/league/50020336/standings"
},
{
"competitionId": 50015602,
"competitionName": "Eng Shield",
"standing_table_link": "https://footylogic.com/en/tournament/league/50015602/standings"
}
]
},
{
"categoryId": 10013,
"categoryName": "Australia",
"categoryImg": "australia",
"competitions": [
{
"competitionId": 50022033,
"competitionName": "Australian Division 1",
"standing_table_link": "https://footylogic.com/en/tournament/league/50022033/standings"
},
{
"competitionId": 50015616,
"competitionName": "Australian FA Cup",
"standing_table_link": "https://footylogic.com/en/tournament/league/50015616/standings"
}
]
},
{
"categoryId": 10200,
"categoryName": "Spain",
"categoryImg": "spain",
"competitions": [
{
"competitionId": 50016200,
"competitionName": "Spanish Division 1",
"standing_table_link": "https://footylogic.com/en/tournament/league/50016200/standings"
},
{
"competitionId": 50019599,
"competitionName": "Spanish Division 2",
"standing_table_link": "https://footylogic.com/en/tournament/league/50019599/standings"
},
{
"competitionId": 50022469,
"competitionName": "Spanish Cup",
"standing_table_link": "https://footylogic.com/en/tournament/league/50022469/standings"
},
{
"competitionId": 50024282,
"competitionName": "Spanish Super Cup",
"standing_table_link": "https://footylogic.com/en/tournament/league/50024282/standings"
}
]
},
{
"categoryId": 10082,
"categoryName": "Germany",
"categoryImg": "germany",
"competitions": [
{
"competitionId": 50016467,
"competitionName": "German Division 1",
"standing_table_link": "https://footylogic.com/en/tournament/league/50016467/standings"
},
{
"competitionId": 50016660,
"competitionName": "German Division 2",
"standing_table_link": "https://footylogic.com/en/tournament/league/50016660/standings"
},
{
"competitionId": 50019550,
"competitionName": "German Cup",
"standing_table_link": "https://footylogic.com/en/tournament/league/50019550/standings"
},
{
"competitionId": 50019595,
"competitionName": "German Super Cup",
"standing_table_link": "https://footylogic.com/en/tournament/league/50019595/standings"
}
]
},
{
"categoryId": 10107,
"categoryName": "Italy",
"categoryImg": "italy",
"competitions": [
{
"competitionId": 50016549,
"competitionName": "Italian Division 1",
"standing_table_link": "https://footylogic.com/en/tournament/league/50016549/standings"
},
{
"competitionId": 50019580,
"competitionName": "Italian Cup",
"standing_table_link": "https://footylogic.com/en/tournament/league/50019580/standings"
},
{
"competitionId": 50024543,
"competitionName": "Italian Super Cup",
"standing_table_link": "https://footylogic.com/en/tournament/league/50024543/standings"
}
]
},
{
"categoryId": 10228,
"categoryName": "USA",
"categoryImg": "united-states-of-america",
"competitions": [
{
"competitionId": 50011183,
"competitionName": "US Football League",
"standing_table_link": "https://footylogic.com/en/tournament/league/50011183/standings"
},
{
"competitionId": 50013586,
"competitionName": "US League Cup",
"standing_table_link": "https://footylogic.com/en/tournament/league/50013586/standings"
}
]
},
{
"categoryId": 10115,
"categoryName": "Korea Republic",
"categoryImg": "south-korea",
"competitions": [
{
"competitionId": 50011096,
"competitionName": "Korean Division 1",
"standing_table_link": "https://footylogic.com/en/tournament/league/50011096/standings"
},
{
"competitionId": 50012908,
"competitionName": "Korean FA Cup",
"standing_table_link": "https://footylogic.com/en/tournament/league/50012908/standings"
}
]
},
{
"categoryId": 10109,
"categoryName": "Japan",
"categoryImg": "japan",
"competitions": [
{
"competitionId": 50010052,
"competitionName": "Japanese Division 1",
"standing_table_link": "https://footylogic.com/en/tournament/league/50010052/standings"
},
{
"competitionId": 50010155,
"competitionName": "Japanese Division 2",
"standing_table_link": "https://footylogic.com/en/tournament/league/50010155/standings"
},
{
"competitionId": 50011744,
"competitionName": "Japanese League Cup",
"standing_table_link": "https://footylogic.com/en/tournament/league/50011744/standings"
},
{
"competitionId": 50014594,
"competitionName": "Emperor's Cup",
"standing_table_link": "https://footylogic.com/en/tournament/league/50014594/standings"
},
{
"competitionId": 50010020,
"competitionName": "Japanese Super Cup",
"standing_table_link": "https://footylogic.com/en/tournament/league/50010020/standings"
}
]
},
{
"categoryId": 10140,
"categoryName": "Mexico",
"categoryImg": "mexico",
"competitions": [
{
"competitionId": 50024375,
"competitionName": "Mexican Premier",
"standing_table_link": "https://footylogic.com/en/tournament/league/50024375/standings"
},
{
"competitionId": 127,
"competitionName": "Mexican Cup",
"standing_table_link": "https://footylogic.com/en/tournament/league/127/standings"
},
{
"competitionId": 141,
"competitionName": "Mexican Super Cup",
"standing_table_link": "https://footylogic.com/en/tournament/league/141/standings"
},
{
"competitionId": 50015005,
"competitionName": "Mexican Champion Cup",
"standing_table_link": "https://footylogic.com/en/tournament/league/50015005/standings"
}
]
},
{
"categoryId": 10010,
"categoryName": "Argentina",
"categoryImg": "argentina",
"competitions": [
{
"competitionId": 50024762,
"competitionName": "Argentine Division 1",
"standing_table_link": "https://footylogic.com/en/tournament/league/50024762/standings"
},
{
"competitionId": 50023611,
"competitionName": "Argentine Cup",
"standing_table_link": "https://footylogic.com/en/tournament/league/50023611/standings"
},
{
"competitionId": 50010688,
"competitionName": "Argentine Super Cup",
"standing_table_link": "https://footylogic.com/en/tournament/league/50010688/standings"
},
{
"competitionId": 910,
"competitionName": "APL Cup",
"standing_table_link": "https://footylogic.com/en/tournament/league/910/standings"
}
]
},
{
"categoryId": 10074,
"categoryName": "France",
"categoryImg": "france",
"competitions": [
{
"competitionId": 50016199,
"competitionName": "French Division 1",
"standing_table_link": "https://footylogic.com/en/tournament/league/50016199/standings"
},
{
"competitionId": 50018675,
"competitionName": "French Division 2",
"standing_table_link": "https://footylogic.com/en/tournament/league/50018675/standings"
},
{
"competitionId": 50023043,
"competitionName": "French FA Cup",
"standing_table_link": "https://footylogic.com/en/tournament/league/50023043/standings"
},
{
"competitionId": 28,
"competitionName": "French League Cup",
"standing_table_link": "https://footylogic.com/en/tournament/league/28/standings"
},
{
"competitionId": 50023652,
"competitionName": "French Champion Trophy",
"standing_table_link": "https://footylogic.com/en/tournament/league/50023652/standings"
}
]
},
{
"categoryId": 10179,
"categoryName": "Russia",
"categoryImg": "russia",
"competitions": [
{
"competitionId": 50016142,
"competitionName": "Russian Premier",
"standing_table_link": "https://footylogic.com/en/tournament/league/50016142/standings"
},
{
"competitionId": 50016363,
"competitionName": "Russian Cup",
"standing_table_link": "https://footylogic.com/en/tournament/league/50016363/standings"
},
{
"competitionId": 50015520,
"competitionName": "Russian Super Cup",
"standing_table_link": "https://footylogic.com/en/tournament/league/50015520/standings"
}
]
},
{
"categoryId": 10208,
"categoryName": "Sweden",
"categoryImg": "sweden",
"competitions": [
{
"competitionId": 50023185,
"competitionName": "Swedish Division 1",
"standing_table_link": "https://footylogic.com/en/tournament/league/50023185/standings"
},
{
"competitionId": 50019777,
"competitionName": "Swedish Cup",
"standing_table_link": "https://footylogic.com/en/tournament/league/50019777/standings"
}
]
},
{
"categoryId": 10174,
"categoryName": "Portugal",
"categoryImg": "portugal",
"competitions": [
{
"competitionId": 50019002,
"competitionName": "Portuguese Premier",
"standing_table_link": "https://footylogic.com/en/tournament/league/50019002/standings"
},
{
"competitionId": 50022009,
"competitionName": "Portuguese Cup",
"standing_table_link": "https://footylogic.com/en/tournament/league/50022009/standings"
},
{
"competitionId": 50016144,
"competitionName": "Portuguese League Cup",
"standing_table_link": "https://footylogic.com/en/tournament/league/50016144/standings"
},
{
"competitionId": 50018847,
"competitionName": "Portuguese Super Cup",
"standing_table_link": "https://footylogic.com/en/tournament/league/50018847/standings"
}
]
},
{
"categoryId": 10163,
"categoryName": "Norway",
"categoryImg": "norway",
"competitions": [
{
"competitionId": 50012569,
"competitionName": "Norwegian Division 1",
"standing_table_link": "https://footylogic.com/en/tournament/league/50012569/standings"
},
{
"competitionId": 50014272,
"competitionName": "Norwegian Cup",
"standing_table_link": "https://footylogic.com/en/tournament/league/50014272/standings"
},
{
"competitionId": 151,
"competitionName": "Norwegian Super Cup",
"standing_table_link": "https://footylogic.com/en/tournament/league/151/standings"
}
]
},
{
"categoryId": 10153,
"categoryName": "Netherlands",
"categoryImg": "netherlands",
"competitions": [
{
"competitionId": 50019000,
"competitionName": "Dutch Division 1",
"standing_table_link": "https://footylogic.com/en/tournament/league/50019000/standings"
},
{
"competitionId": 50019001,
"competitionName": "Dutch Division 2",
"standing_table_link": "https://footylogic.com/en/tournament/league/50019001/standings"
},
{
"competitionId": 50022411,
"competitionName": "Dutch Cup",
"standing_table_link": "https://footylogic.com/en/tournament/league/50022411/standings"
},
{
"competitionId": 50018763,
"competitionName": "Dutch Super Cup",
"standing_table_link": "https://footylogic.com/en/tournament/league/50018763/standings"
}
]
},
{
"categoryId": 10030,
"categoryName": "Brazil",
"categoryImg": "brazil",
"competitions": [
{
"competitionId": 50013324,
"competitionName": "Brazilian Division 1",
"standing_table_link": "https://footylogic.com/en/tournament/league/50013324/standings"
},
{
"competitionId": 50024101,
"competitionName": "Brazilian Paulista League",
"standing_table_link": "https://footylogic.com/en/tournament/league/50024101/standings"
},
{
"competitionId": 50012097,
"competitionName": "Brazilian Cup",
"standing_table_link": "https://footylogic.com/en/tournament/league/50012097/standings"
}
]
},
{
"categoryId": 10043,
"categoryName": "Chile",
"categoryImg": "chile",
"competitions": [
{
"competitionId": 50009057,
"competitionName": "Chilean Division 1",
"standing_table_link": "https://footylogic.com/en/tournament/league/50009057/standings"
},
{
"competitionId": 50014689,
"competitionName": "Chilean Cup",
"standing_table_link": "https://footylogic.com/en/tournament/league/50014689/standings"
},
{
"competitionId": 50009056,
"competitionName": "Chilean Super Cup",
"standing_table_link": "https://footylogic.com/en/tournament/league/50009056/standings"
}
]
},
{
"categoryId": 10021,
"categoryName": "Belgium",
"categoryImg": "belgium",
"competitions": [
{
"competitionId": 50016588,
"competitionName": "Belgian Division 1",
"standing_table_link": "https://footylogic.com/en/tournament/league/50016588/standings"
},
{
"competitionId": 50022259,
"competitionName": "Belgian Cup",
"standing_table_link": "https://footylogic.com/en/tournament/league/50022259/standings"
},
{
"competitionId": 50016140,
"competitionName": "Belgian Super Cup",
"standing_table_link": "https://footylogic.com/en/tournament/league/50016140/standings"
}
]
},
{
"categoryId": 10246,
"categoryName": "Scotland",
"categoryImg": "scotland",
"competitions": [
{
"competitionId": 50018485,
"competitionName": "Scottish Premier",
"standing_table_link": "https://footylogic.com/en/tournament/league/50018485/standings"
},
{
"competitionId": 50024631,
"competitionName": "Scottish FA Cup",
"standing_table_link": "https://footylogic.com/en/tournament/league/50024631/standings"
},
{
"competitionId": 50015522,
"competitionName": "Scottish League Cup",
"standing_table_link": "https://footylogic.com/en/tournament/league/50015522/standings"
}
]
}
]

View File

@@ -0,0 +1,78 @@
{
"Season": [
{
"id": 4446,
"name": "2023/24 ",
"competitionId": 50016588
},
{
"id": 4219,
"name": "2022/23 ",
"competitionId": 50016588
},
{
"id": 3979,
"name": "2021/22 ",
"competitionId": 50016588
},
{
"id": 3647,
"name": "2020/21 ",
"competitionId": 50016588
},
{
"id": 3221,
"name": "2019/20 ",
"competitionId": 50016588
},
{
"id": 3025,
"name": "2018/19 ",
"competitionId": 50016588
},
{
"id": 2697,
"name": "2017/18 ",
"competitionId": 50016588
},
{
"id": 2006,
"name": "2016/17 ",
"competitionId": 50016588
},
{
"id": 1781,
"name": "2015/16 ",
"competitionId": 50016588
}
],
"Options": [
{
"id": 1,
"name": "All",
"competitionId": 50016588
},
{
"id": 2,
"name": "Home",
"competitionId": 50016588
},
{
"id": 3,
"name": "Away",
"competitionId": 50016588
}
],
"betType": [
{
"id": 1,
"name": "HalfTime",
"competitionId": 50016588
},
{
"id": 2,
"name": "FullTime",
"competitionId": 50016588
}
]
}

14
task1/src/stub/index.html Normal file
View File

@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
hello json server
</body>
</html>

View File

@@ -0,0 +1,29 @@
{
"data": {
"eventId": "50024766",
"homeTeamLogo": 13307,
"awayTeamLogo": 10939,
"homeTeamName": "Union Saint Gilloise",
"awayTeamName": "Anderlecht",
"competitionName": "Belgian Cup",
"kickOffTime": "2024-01-25 19:30:00",
"homeOdds": 1.68,
"awayOdds": 3.95,
"drawOdds": 3.5,
"homeTeamId": 50003201,
"homeTeamIdNav": 50003201,
"awayTeamId": 50000175,
"awayTeamIdNav": 50000175,
"matchNumber": null,
"homeTeamPos": "1",
"awayTeamPos": "2",
"matchDayCode": "FB0744",
"competitionId": 50022259,
"tournamentType": "League",
"homePlayerAnalysis": 2,
"awayPlayerAnalysis": 2,
"homeLeagueShortName": "BEL L1",
"awayLeagueShortName": "BEL L1",
"competitionIdNav": 50022259
}
}

View File

@@ -0,0 +1,188 @@
{
"statusCode": 200,
"data": {
"recent8Results": {
"homeTeam": [
{
"competitionName": "Belgian Division 1",
"kickOff": "2024-01-21 15:00:00",
"homeOrAway": "H",
"oppTeamName": "Sint Truiden",
"teamPos": 8,
"fullTimeScore": "2:1",
"halfTimeScore": "1:1",
"fullTimeResult": "W",
"firstHalfHad": "D"
},
{
"competitionName": "Belgian Division 1",
"kickOff": "2023-12-26 19:45:00",
"homeOrAway": "A",
"oppTeamName": "Bruges",
"teamPos": 4,
"fullTimeScore": "1:1",
"halfTimeScore": "1:0",
"fullTimeResult": "D",
"firstHalfHad": "W"
},
{
"competitionName": "Belgian Division 1",
"kickOff": "2023-12-23 15:00:00",
"homeOrAway": "A",
"oppTeamName": "Eupen",
"teamPos": 14,
"fullTimeScore": "2:1",
"halfTimeScore": "2:0",
"fullTimeResult": "W",
"firstHalfHad": "W"
},
{
"competitionName": "Belgian Division 1",
"kickOff": "2023-12-17 15:00:00",
"homeOrAway": "H",
"oppTeamName": "KV Mechelen",
"teamPos": 11,
"fullTimeScore": "1:0",
"halfTimeScore": "0:0",
"fullTimeResult": "W",
"firstHalfHad": "D"
},
{
"competitionName": "UE Cup",
"kickOff": "2023-12-14 17:45:00",
"homeOrAway": "H",
"oppTeamName": "Liverpool",
"teamPos": 1,
"fullTimeScore": "2:1",
"halfTimeScore": "2:1",
"fullTimeResult": "W",
"firstHalfHad": "W"
},
{
"competitionName": "Belgian Division 1",
"kickOff": "2023-12-10 18:15:00",
"homeOrAway": "A",
"oppTeamName": "Charleroi",
"teamPos": 12,
"fullTimeScore": "3:1",
"halfTimeScore": "1:0",
"fullTimeResult": "W",
"firstHalfHad": "W"
},
{
"competitionName": "Belgian Cup",
"kickOff": "2023-12-07 19:00:00",
"homeOrAway": "A",
"oppTeamName": "Waasland Beveren",
"teamPos": null,
"fullTimeScore": "2:0",
"halfTimeScore": "0:0",
"fullTimeResult": "W",
"firstHalfHad": "D"
},
{
"competitionName": "Belgian Division 1",
"kickOff": "2023-12-03 18:15:00",
"homeOrAway": "H",
"oppTeamName": "Cercle Bruges",
"teamPos": 5,
"fullTimeScore": "2:1",
"halfTimeScore": "2:1",
"fullTimeResult": "W",
"firstHalfHad": "W"
}
],
"awayTeam": [
{
"competitionName": "Belgian Division 1",
"kickOff": "2024-01-21 17:30:00",
"homeOrAway": "A",
"oppTeamName": "OH Leuven",
"teamPos": 14,
"fullTimeScore": "1:1",
"halfTimeScore": "0:1",
"fullTimeResult": "D",
"firstHalfHad": "L"
},
{
"competitionName": "Belgian Division 1",
"kickOff": "2023-12-27 19:45:00",
"homeOrAway": "H",
"oppTeamName": "Cercle Bruges",
"teamPos": 7,
"fullTimeScore": "2:0",
"halfTimeScore": "1:0",
"fullTimeResult": "W",
"firstHalfHad": "W"
},
{
"competitionName": "Belgian Division 1",
"kickOff": "2023-12-23 19:45:00",
"homeOrAway": "H",
"oppTeamName": "Genk",
"teamPos": 7,
"fullTimeScore": "2:1",
"halfTimeScore": "0:0",
"fullTimeResult": "W",
"firstHalfHad": "D"
},
{
"competitionName": "Belgian Division 1",
"kickOff": "2023-12-17 17:30:00",
"homeOrAway": "A",
"oppTeamName": "Antwerp",
"teamPos": 4,
"fullTimeScore": "1:1",
"halfTimeScore": "1:0",
"fullTimeResult": "D",
"firstHalfHad": "W"
},
{
"competitionName": "Belgian Division 1",
"kickOff": "2023-12-10 17:30:00",
"homeOrAway": "H",
"oppTeamName": "Standard",
"teamPos": 9,
"fullTimeScore": "2:2",
"halfTimeScore": "1:1",
"fullTimeResult": "D",
"firstHalfHad": "D"
},
{
"competitionName": "Belgian Cup",
"kickOff": "2023-12-07 19:30:00",
"homeOrAway": "H",
"oppTeamName": "Standard",
"teamPos": null,
"fullTimeScore": "2:0",
"halfTimeScore": "1:0",
"fullTimeResult": "W",
"firstHalfHad": "W"
},
{
"competitionName": "Belgian Division 1",
"kickOff": "2023-12-01 19:45:00",
"homeOrAway": "A",
"oppTeamName": "Westerlo",
"teamPos": 15,
"fullTimeScore": "3:1",
"halfTimeScore": "1:0",
"fullTimeResult": "W",
"firstHalfHad": "W"
},
{
"competitionName": "Belgian Division 1",
"kickOff": "2023-11-26 17:30:00",
"homeOrAway": "H",
"oppTeamName": "RWD Molenbeek",
"teamPos": 10,
"fullTimeScore": "2:1",
"halfTimeScore": "0:1",
"fullTimeResult": "W",
"firstHalfHad": "L"
}
]
}
},
"message": "success"
}

View File

@@ -0,0 +1,186 @@
{
"data": {
"recent8Results": {
"homeTeam": [
{
"competitionName": "Belgian Division 1",
"kickOff": "2024-01-21 15:00:00",
"homeOrAway": "H",
"oppTeamName": "Sint Truiden",
"teamPos": 8,
"fullTimeScore": "2:1",
"halfTimeScore": "1:1",
"fullTimeResult": "W",
"firstHalfHad": "D"
},
{
"competitionName": "Belgian Division 1",
"kickOff": "2023-12-26 19:45:00",
"homeOrAway": "A",
"oppTeamName": "Bruges",
"teamPos": 4,
"fullTimeScore": "1:1",
"halfTimeScore": "1:0",
"fullTimeResult": "D",
"firstHalfHad": "W"
},
{
"competitionName": "Belgian Division 1",
"kickOff": "2023-12-23 15:00:00",
"homeOrAway": "A",
"oppTeamName": "Eupen",
"teamPos": 14,
"fullTimeScore": "2:1",
"halfTimeScore": "2:0",
"fullTimeResult": "W",
"firstHalfHad": "W"
},
{
"competitionName": "Belgian Division 1",
"kickOff": "2023-12-17 15:00:00",
"homeOrAway": "H",
"oppTeamName": "KV Mechelen",
"teamPos": 11,
"fullTimeScore": "1:0",
"halfTimeScore": "0:0",
"fullTimeResult": "W",
"firstHalfHad": "D"
},
{
"competitionName": "UE Cup",
"kickOff": "2023-12-14 17:45:00",
"homeOrAway": "H",
"oppTeamName": "Liverpool",
"teamPos": 1,
"fullTimeScore": "2:1",
"halfTimeScore": "2:1",
"fullTimeResult": "W",
"firstHalfHad": "W"
},
{
"competitionName": "Belgian Division 1",
"kickOff": "2023-12-10 18:15:00",
"homeOrAway": "A",
"oppTeamName": "Charleroi",
"teamPos": 12,
"fullTimeScore": "3:1",
"halfTimeScore": "1:0",
"fullTimeResult": "W",
"firstHalfHad": "W"
},
{
"competitionName": "Belgian Cup",
"kickOff": "2023-12-07 19:00:00",
"homeOrAway": "A",
"oppTeamName": "Waasland Beveren",
"teamPos": null,
"fullTimeScore": "2:0",
"halfTimeScore": "0:0",
"fullTimeResult": "W",
"firstHalfHad": "D"
},
{
"competitionName": "Belgian Division 1",
"kickOff": "2023-12-03 18:15:00",
"homeOrAway": "H",
"oppTeamName": "Cercle Bruges",
"teamPos": 5,
"fullTimeScore": "2:1",
"halfTimeScore": "2:1",
"fullTimeResult": "W",
"firstHalfHad": "W"
}
],
"awayTeam": [
{
"competitionName": "Belgian Division 1",
"kickOff": "2024-01-21 17:30:00",
"homeOrAway": "A",
"oppTeamName": "OH Leuven",
"teamPos": 14,
"fullTimeScore": "1:1",
"halfTimeScore": "0:1",
"fullTimeResult": "D",
"firstHalfHad": "L"
},
{
"competitionName": "Belgian Division 1",
"kickOff": "2023-12-27 19:45:00",
"homeOrAway": "H",
"oppTeamName": "Cercle Bruges",
"teamPos": 7,
"fullTimeScore": "2:0",
"halfTimeScore": "1:0",
"fullTimeResult": "W",
"firstHalfHad": "W"
},
{
"competitionName": "Belgian Division 1",
"kickOff": "2023-12-23 19:45:00",
"homeOrAway": "H",
"oppTeamName": "Genk",
"teamPos": 7,
"fullTimeScore": "2:1",
"halfTimeScore": "0:0",
"fullTimeResult": "W",
"firstHalfHad": "D"
},
{
"competitionName": "Belgian Division 1",
"kickOff": "2023-12-17 17:30:00",
"homeOrAway": "A",
"oppTeamName": "Antwerp",
"teamPos": 4,
"fullTimeScore": "1:1",
"halfTimeScore": "1:0",
"fullTimeResult": "D",
"firstHalfHad": "W"
},
{
"competitionName": "Belgian Division 1",
"kickOff": "2023-12-10 17:30:00",
"homeOrAway": "H",
"oppTeamName": "Standard",
"teamPos": 9,
"fullTimeScore": "2:2",
"halfTimeScore": "1:1",
"fullTimeResult": "D",
"firstHalfHad": "D"
},
{
"competitionName": "Belgian Cup",
"kickOff": "2023-12-07 19:30:00",
"homeOrAway": "H",
"oppTeamName": "Standard",
"teamPos": null,
"fullTimeScore": "2:0",
"halfTimeScore": "1:0",
"fullTimeResult": "W",
"firstHalfHad": "W"
},
{
"competitionName": "Belgian Division 1",
"kickOff": "2023-12-01 19:45:00",
"homeOrAway": "A",
"oppTeamName": "Westerlo",
"teamPos": 15,
"fullTimeScore": "3:1",
"halfTimeScore": "1:0",
"fullTimeResult": "W",
"firstHalfHad": "W"
},
{
"competitionName": "Belgian Division 1",
"kickOff": "2023-11-26 17:30:00",
"homeOrAway": "H",
"oppTeamName": "RWD Molenbeek",
"teamPos": 10,
"fullTimeScore": "2:1",
"halfTimeScore": "0:1",
"fullTimeResult": "W",
"firstHalfHad": "L"
}
]
}
}
}

Some files were not shown because too many files have changed in this diff Show More