Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dec, 16 Update #47

Merged
merged 2 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions .devcontainer/requirements.prod.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
babel
beautifulsoup4
flask
gitpython
html5lib
numpy
paste
Pillow
python-dateutil
python-dotenv
python-telegram-bot
requests
python-dateutil
numpy
Pillow
gitpython
babel
waitress
paste
waitress
Binary file added assets/teams/Hapoel Petah Tikva.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/teams/Ironi Ashkelon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/teams/Maccabi Petah Tikva.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,21 @@
"name": "Beitar Jerusalem",
"url": "https://www.football.co.il/beitar-jerusalem/",
"logo": "https://static.football.co.il/wp-content/themes/kingclub-theme/images/teams/4524.png",
},
'הפועל פ"ת': {
"name": "Hapoel Petah Tikva",
"url": "https://www.football.co.il/hapoel-petah-tikva/",
"logo": "https://static.football.co.il/wp-content/themes/kingclub-theme/images/teams/4542.png",
},
'עירוני אשקלון': {
"name": "Ironi Ashkelon",
"url": "https://www.football.co.il/hapoel-ironi-ashkelon/",
"logo": "https://upload.wikimedia.org/wikipedia/he/9/90/Logo_hapoel_ashkelon.png",
},
'מכבי פ"ת': {
"name": "Maccabi Petah Tikva",
"url": "https://www.football.co.il/maccabi-petah-tikva/",
"logo": "https://static.football.co.il/wp-content/themes/kingclub-theme/images/teams/15006.png",
}
}

Expand Down
8 changes: 5 additions & 3 deletions web_scrape.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,15 @@ def __init__(self):

def scrape(self):
try:
response = requests.get(self.url, headers=random_ua(), timeout=30)
response = requests.get(self.url, headers=random_ua(), timeout=60)
response.raise_for_status()

self.soup = BeautifulSoup(response.text, "html5lib")
except requests.exceptions.HTTPError as err:
logger.error(f"HTTPError: {err}")
return f"<pre>{str(err)}</pre>"
except requests.exceptions.ConnectionError as err:
self.conn_err = True
logger.error(f"ConnectionError: {err}")
return f"<pre>{str(err)}</pre>"

Expand Down Expand Up @@ -75,7 +76,8 @@ def scrape(self):

def decoratored_games(self, scraped):
if isinstance(scraped, str):
gen_static_page({})
if not self.conn_err:
gen_static_page({})
return scraped

deco_games = {}
Expand Down Expand Up @@ -196,7 +198,7 @@ def fetch_logo(self):
continue

try:
r = requests.get(logo_url)
r = requests.get(logo_url, timeout=60)
with open(full_path, "wb") as f:
logger.info(f"Writing new file '{full_path}'")
f.write(r.content)
Expand Down
Loading