Skip to content
Open
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
4 changes: 3 additions & 1 deletion octofree/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -722,8 +722,10 @@ def main():
save_last_extracted_sessions(current_sessions)
logging.debug(f"💾 [STORAGE] Updated last_extracted_sessions.json with {len(current_sessions)} session(s)")

else:
elif html_content is None:
logging.error("Failed to fetch HTML content.")
else:
logging.info("ℹ️ No sessions extracted from HTML (page may have no sessions listed yet)")

if single_run:
break
Expand Down
7 changes: 4 additions & 3 deletions octofree/scraper_website.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ def extract_sessions(html_content):
sessions = []
session_type = None
# Try to find "Next Sessions:" first (for multiple)
match = re.search(r'Next\s+Sessions?:', html_content, re.IGNORECASE)
# Octopus pages vary between "Next Sessions:" and "Next Free Electricity sessions:"
match = re.search(r'Next\s+(?:Free\s+Electricity\s+)?Sessions?:', html_content, re.IGNORECASE)
if match:
session_type = 'next'
start_pos = match.end()
Expand All @@ -86,8 +87,8 @@ def extract_sessions(html_content):
found = re.findall(r'\d+(?:am|pm)?-\d+(?:am|pm)?,\s*\w+\s*\d+(?:st|nd|rd|th)?\s*\w+', part, re.IGNORECASE)
sessions.extend(found)
else:
# Check for "Last Session:"
match = re.search(r'Last\s+Session:', html_content, re.IGNORECASE)
# Check for "Last Session:" or "Last Free Electricity sessions:"
match = re.search(r'Last\s+(?:Free\s+Electricity\s+)?Sessions?:', html_content, re.IGNORECASE)
if match:
session_type = 'last'
start_pos = match.end()
Expand Down