Created
April 22, 2019 15:36
-
-
Save sai-github/040ae111a4721a27b4346cc21bd931c8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import winsound | |
import requests | |
from bs4 import BeautifulSoup | |
check_show_count = True; | |
when_i_saw_count = 0; | |
ping_count = 0; | |
try: | |
while check_show_count: | |
page=requests.get('https://in.bookmyshow.com/buytickets/avengers-endgame-bengaluru/movie-bang-ET00100559-MT/20190427') | |
# https://in.bookmyshow.com/buytickets/avengers-endgame-bengaluru/movie-bang-ET00100559-MT/20190427 | |
# | |
ping_count+=1; | |
soup=BeautifulSoup(page.text,'html.parser') | |
cfbs_obj=soup.find("li",{"data-id":"CFBS"}) | |
show_items=cfbs_obj.find("div",{"class":"body"}).findAll("div",{"data-online":"Y"}) | |
if len(show_items)!=when_i_saw_count: | |
check_show_count=False; | |
print("Woo !, ticket found, trying to ring a bell"); | |
else: | |
print("Alas!, no new show since " + str(ping_count) + " pings"); | |
print("again pinging the url") | |
time.sleep(30); | |
try: | |
while True: | |
winsound.MessageBeep() | |
time.sleep(1) | |
except KeyboardInterrupt: | |
print("Notification sound stopped"); | |
except KeyboardInterrupt: | |
print('interrupted!') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment