Skip to content

Commit

Permalink
Maston: separation of days by empty line
Browse files Browse the repository at this point in the history
  • Loading branch information
trnila committed Jan 8, 2024
1 parent 19231b9 commit 8670013
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions lunches.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,22 +398,19 @@ def maston(dom):

today = datetime.datetime.strftime(datetime.datetime.now(), "%-d%-m")
capturing = False
soup = False
for line in text.splitlines():
if capturing:
print(line)
if line.replace(' ', '').replace('.', '').endswith(today):
capturing = True
elif capturing:
if not line.strip():
break
if 'POLÉVKA' in line:
if soup:
break
soup = True
yield Soup(line.split(':', 1)[1])
else:
m = re.search('((?P<num>\d)\))?\s*(?P<name>.+)(\s*(?P<price>\d+),-)?', line)
if m:
yield Lunch(**m.groupdict())
else:
if line.replace(' ', '').replace('.', '').endswith(today):
capturing = True


@restaurant("Kozlovna U Ježka", "https://www.menicka.cz/api/iframe/?id=5122", Location.Dubina)
def kozlovna(dom):
Expand Down

0 comments on commit 8670013

Please sign in to comment.