Skip to content

Commit

Permalink
fix: 220, 301 메뉴 이름 수정 (#56) (#57)
Browse files Browse the repository at this point in the history
* fix: 220동 메뉴이름 수정
* fix: 220동 운영시간이 메뉴에 나옴
* fix: 301 takeout 메뉴 오류
  • Loading branch information
GanziDaeyong authored Nov 5, 2023
1 parent cc3035f commit 0ac6230
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
5 changes: 5 additions & 0 deletions crawlers/base_crawler.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ def text_normalizer(text, only_letters=False):
r"\.",
"♣",
"▷",
"ㅁ",
"~",
]
text = re.sub(r"\n|\(\)|<>", "", text).strip().strip(":")
text = re.sub(r"\xa0", " ", text)
Expand Down Expand Up @@ -144,6 +146,9 @@ class RestaurantCrawler(metaclass=ABCMeta):
"점심",
"저녁",
"배식시간",
"평일",
"토요일",
"TakeOut",
]

def __init__(self):
Expand Down
8 changes: 8 additions & 0 deletions crawlers/snuco_crawler.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,14 @@ def crawl(self, soup, **kwargs):
meal = self.normalize(meal)
# is_meal_name에서 normalizer도 호출한다.
if self.is_meal_name(meal.name):
# ISSUE#54 220동 이름 오류 수정
# ex) ㅁ 바비든든( ~ ): 덮밥류 -> 바비든든: 덮밥류
if meal.restaurant == "220동식당":
name_cleaned = meal.name
for to_clean in ["ㅁ ", "( ~ )", "(~)"]:
name_cleaned = name_cleaned.replace(to_clean, "")
meal.set_name(name_cleaned)

# 교직원 식당 이름 설정을 위한 로직
if (
meal.restaurant == "자하연식당"
Expand Down
1 change: 1 addition & 0 deletions handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ def crawl(event, context):
crawled_meals = []
for crawler in crawlers:
crawled_meals = crawled_meals + crawler.meals

today = datetime.datetime.now(timezone("Asia/Seoul")).date()
crawled_meals = list(filter(lambda meal: meal.date >= today, crawled_meals))
restaurants_transaction(crawled_meals, cursor)
Expand Down

0 comments on commit 0ac6230

Please sign in to comment.