만약 imax상영을 여러개 한다면 어떻게 구현을 해야되나요?
저도 궁금해서 한번 코드 작성해보았는데, 여러개도 알림이 가도록 구현이 가능하네요! 참고로 저는 imax 상영 영화 말고, tempurCinema 상영 영화로 했다는 점 유의하시길 바랍니다. 각각의 영화 별로 나눠진 col-times 클래스의 div 태그 안쪽 내용으로 반복문을 돌리며, temputCinema 클래스인 span 태그가 있는지 조건문으로 확인하고, 있다면 해당 col-times 클래스의 div 태그에 걸쳐지는 모든 영역 중 strong 태그의 텍스트를 선택하여 메시지를 전송할 수 있습니다. import requests import telegram from bs4 import BeautifulSoup from apscheduler.schedulers.blocking import BlockingScheduler bot = telegram.Bot( token = '5087679237:AAHASP7XCcdj26RHW20HZFt56YTzndsaZe0' ) url = 'http://www.cgv.co.kr/common/showtimes/iframeTheater.aspx?areacode=01&theatercode=P013&date=20220121&screencodes=&screenratingcode=09®ioncode=103' def job_function (): html = requests.get(url) soup = BeautifulSoup(html.text , 'html.parser' ) parent = soup.select( 'div.col-times' ) for i in parent: tempurCinema = i.select_one( 'span.tempurCinema' ) if (tempurCinema): title = i.select_one( 'div.info-movie > a > strong' ).text.strip() bot.sendMessage( chat_id = 5062868275 , text =title + " tempurCinema 예매가 열렸습니다 ." ) sched.pause() #else: #bot.sendMessage(chat_id=5062868275, text = "tempurCinema 예매가 열리지 않았습니다 .") #print('tempurCinema 예매가 열리지 않았습니다 .') sched = BlockingScheduler() sched.add_job(job_function , 'interval' , seconds = 5 ) sched.start()