@@ -134,13 +134,29 @@ def _parser_east1_course(menu_list : str, time : int):
134
134
Menu = list (filter (lambda x : x != '' and x != ' ' and x != '\n ' , Menu ))
135
135
Menu = list (filter (lambda x : '하루과일' not in x and '글로벌' not in x , Menu ))
136
136
137
+ #2025-05-09 - 동맛골 1층 카페테리아가 식기세척기 고장으로 인해 운영하지 않음
138
+ #이때 '미운영' 이라는 텍스트가 포함되어 있었음.
139
+
137
140
#모든 메뉴가 100원 단위. -> '00원' 이라는 텍스트가 포함된 부분을 찾으면 어디인지 알 수 있다.
138
141
#이걸 기준으로 각 코스를 나누면 된다.
139
142
Courses = {}
143
+ #2025.05 샐러드 메뉴 등장 - 샐러드 처리 로직
144
+ offset = 0
145
+ for line in Menu :
146
+ if '샐러드' in line :
147
+ offset += 1
148
+ else :
149
+ break
150
+ #샐러드 메뉴정보 -> 제거
151
+ for _ in range (offset ):
152
+ Menu .pop (0 )
153
+
140
154
for txt in Menu :
141
155
#하루과일 : 파싱 x
142
156
if '하루과일' in txt :
143
157
break #하루과일은 항상 맨 마지막에 있다.
158
+ if '미운영' in txt :
159
+ break #어떤 이유로 식당이 운영하지 않는경우
144
160
#코스 이름이 나온 경우
145
161
if ('00원' in txt ) or ('<' in txt and '>' in txt ): #카페테리아 메뉴까지 같이 처리하기 위해 조건 추가.
146
162
txt_match = re .match (r"<(.+?) (\d+,?\d*)원>" , txt .strip ()) #코스 이름과 가격은 <> 안에
@@ -175,9 +191,21 @@ def _parser_east1_cafeteria(menu_list : str, time : int) -> list:
175
191
Menu = list (filter (lambda x : x != '' and x != ' ' and x != '\n ' , Menu ))
176
192
Menus = []
177
193
194
+
178
195
#토/일요일 같이 영업 안하는 경우.
179
196
if len (Menu ) == 0 :
180
197
return {}
198
+
199
+ #2025.05 샐러드 메뉴 등장 - 샐러드 처리 로직
200
+ offset = 0
201
+ for line in Menu :
202
+ if '샐러드' in line :
203
+ offset += 1
204
+ else :
205
+ break
206
+ #샐러드 메뉴정보 -> 제거
207
+ for _ in range (offset ):
208
+ Menu .pop (0 )
181
209
182
210
#카페테리아가 영업하지 않는 날
183
211
if '<Cafeteria>' not in Menu .pop (0 ):
@@ -193,6 +221,7 @@ def _parser_east1_cafeteria(menu_list : str, time : int) -> list:
193
221
allergy_list = [int (num ) for num in allergy .split ("," )] if allergy else [] # 숫자 목록을 리스트로 변환
194
222
price = int (txt_match .group (3 ).replace ("," , "" )) # 쉼표 제거 후 가격 정수 변환
195
223
Menus .append ({'menu_name' : menu_name , 'price' : price , 'allergy' : allergy_list })
224
+ print (f"최종 결과 : { Menus } " )
196
225
return Menus
197
226
198
227
else :
@@ -212,6 +241,18 @@ def _parser_east2(menu_list : str, time : int):
212
241
return {}
213
242
if '미운영' in Menu [0 ]:
214
243
return {}
244
+
245
+ #2025-05 샐러드 메뉴 등장 - 샐러드 처리 로직. (샐러드는 항상 맨 윗줄에 있고, 각 줄별로 샐러드 라는 단어 나옴).
246
+ offset = 0
247
+ for line in Menu :
248
+ if '샐러드' in line :
249
+ offset += 1
250
+ else :
251
+ break
252
+ #샐러드 메뉴정보 -> 제거
253
+ for _ in range (offset ):
254
+ Menu .pop (0 )
255
+
215
256
216
257
Courses = {}
217
258
for txt in Menu :
@@ -222,6 +263,7 @@ def _parser_east2(menu_list : str, time : int):
222
263
break
223
264
#코스 이름이 나온 경우 - 동맛골 2층은 '<>'로 가격이 둘러쌓여 있음.
224
265
if '00원' in txt :
266
+ print (txt )
225
267
txt_match = re .match (r"<(.+?) (\d+,?\d*)원>" , txt .strip ())
226
268
course_name = txt_match .group (1 )
227
269
course_price = int (txt_match .group (2 ).replace ("," , "" ))
@@ -413,7 +455,6 @@ def crawl_daily_meal(date : str):
413
455
pipe .json ().set (course_key ,'.' , course_meal )
414
456
pipe .execute ()
415
457
416
- print ("celery가 일하고 있어요!" )
417
458
return
418
459
419
460
0 commit comments