Skip to content

Instantly share code, notes, and snippets.

@sai-github
Created April 22, 2019 15:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sai-github/040ae111a4721a27b4346cc21bd931c8 to your computer and use it in GitHub Desktop.
Save sai-github/040ae111a4721a27b4346cc21bd931c8 to your computer and use it in GitHub Desktop.
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