File tree 2 files changed +12
-2
lines changed
2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -218,7 +218,12 @@ def message():
218
218
res = requests .get (url )
219
219
result = BeautifulSoup (res .content , 'html.parser' )
220
220
bab_tag = result .select ('table > tbody > tr' )
221
- brd_num = str (bab_tag [0 ]['brd_num' ])
221
+ brd_num = ""
222
+ brd_check = result .select ('table > tbody > tr > td.titleLeft' )
223
+ for i in range (0 ,2 ):
224
+ if "식당메뉴" in brd_check [i ].text :
225
+ brd_num = str (bab_tag [i ]['brd_num' ])
226
+ break
222
227
url2 = 'http://pal.postech.ac.kr/Board.pal?top=6&sub=12&sub2=0&method=boardView&pageMode=pal&mode=&brd_id=pal_cafeteria&brd_num={0}¤tPage=1&user_browser=msie_false&search_type=brd_subject&search_text=#' .format (brd_num )
223
228
res2 = requests .get (url2 )
224
229
result2 = BeautifulSoup (res2 .content ,'html.parser' )
Original file line number Diff line number Diff line change 6
6
res = requests .get (url )
7
7
result = BeautifulSoup (res .content , 'html.parser' )
8
8
bab_tag = result .select ('table > tbody > tr' )
9
- brd_num = str (bab_tag [0 ]['brd_num' ])
9
+ brd_check = result .select ('table > tbody > tr > td.titleLeft' )
10
+ for i in range (0 ,2 ):
11
+ if "식당메뉴" in brd_check [i ].text :
12
+ brd_num = str (bab_tag [i ]['brd_num' ])
13
+ break
14
+ print (brd_num )
10
15
url2 = 'http://pal.postech.ac.kr/Board.pal?top=6&sub=12&sub2=0&method=boardView&pageMode=pal&mode=&brd_id=pal_cafeteria&brd_num={0}¤tPage=1&user_browser=msie_false&search_type=brd_subject&search_text=#' .format (brd_num )
11
16
res2 = requests .get (url2 )
12
17
result2 = BeautifulSoup (res2 .content ,'html.parser' )
You can’t perform that action at this time.
0 commit comments