Skip to content

Commit

Permalink
두레미담 주문식 메뉴 수정 & 자하연 식당 이름 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
GoGiants1 committed Feb 26, 2024
1 parent 2548314 commit 479b004
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
2 changes: 1 addition & 1 deletion crawlers/base_crawler.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def normalize(self, meal, **kwargs):

def is_meal_name_when_normalized(self, name):
normalized_name = text_normalizer(name, True)
if not normalized_name:
if not normalized_name or normalized_name == "메뉴":
return False
is_meal_name = all(re.match(".*" + p + ".*", normalized_name) is None for p in self.not_meal)
return is_meal_name
Expand Down
10 changes: 3 additions & 7 deletions crawlers/snuco_crawler.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ def __init__(self):
r"말렌카케이크",
"1조각홀케이크",
"식사",
"메뉴",
"사이드",
]

Expand Down Expand Up @@ -144,10 +143,7 @@ async def run_30days(self):
async def run(self, date=None, **kwargs):
if not date:
date = datetime.datetime.now(timezone("Asia/Seoul")).date()
url = (
self.url
+ f"?field_menu_date_value_1%5Bvalue%5D%5Bdate%5D=&field_menu_date_value%5Bvalue%5D%5Bdate%5D={date.month}%2F{date.day}%2F{date.year}"
)
url = self.url + f"?date={date.year}-{date.month:02d}-{date.day:02d}"
await super().run(url, date=date, **kwargs)

def found_meal(self, meal):
Expand Down Expand Up @@ -200,11 +196,11 @@ def crawl(self, soup, **kwargs):

# 교직원 식당 이름 설정을 위한 로직
if (
meal.restaurant == "자하연식당"
(meal.restaurant == "자하연식당 3층" or "자하연식당" in meal.restaurant)
and last_meal
and ("교직" in last_meal.name or "교직" in last_meal.restaurant)
) or meal.restaurant in self.jaha_faculty_keyword:
meal.set_restaurant("자하연식당>3층교직메뉴")
meal.set_restaurant("자하연식당 3층")

# 다음 한줄만 추가하는 경우
if not next_line_merged and self.is_next_line_keyword(last_meal):
Expand Down

0 comments on commit 479b004

Please sign in to comment.