Skip to content

Instantly share code, notes, and snippets.

@vipulgupta2048
Last active April 20, 2019 18:24
Show Gist options
  • Save vipulgupta2048/d4ffc1a7b84ae1325ab3ccd58de1e5bf to your computer and use it in GitHub Desktop.
Save vipulgupta2048/d4ffc1a7b84ae1325ab3ccd58de1e5bf to your computer and use it in GitHub Desktop.
Get notified about tickets @ BookMyShow, whatever it takes.
# Owner - Vipul Gupta (@vipulgupta2048)
# Description - A infinite loop trapping Bookmyshow to let them know that you have come to bargain for tickets. Well, only until they block you.
# Real Description - Infinite loop requesting BMS every 3 minutes for availablity for Movie Tickets.
# Pre-requistes - sudo apt install beep
# - pip install beautifulsoup4 requests
# - sudo modprobe pcspkr
# Language - Python3
import requests
from lxml import html
from bs4 import BeautifulSoup
import os
import time
Movie_url = ENTER_MOVIE_URL
# Test URL be like https://in.bookmyshow.com/national-capital-region-ncr/movies/avengers-endgame/ET00090482
while True:
r = BeautifulSoup(requests.get(Movie_url).content, "html.parser").find("a", {"class":"showtimes btn _cuatro"})
if(r!=None):
os.system("beep")
print("Get the tickets Whatever it takes")
else:
print("Tickets aren't open yet")
time.sleep(180)
# https://in.bookmyshow.com/national-capital-region-ncr/movies/avengers-endgame/ET00090482
# For testing - https://in.bookmyshow.com/national-capital-region-ncr/movies/shazam/ET00072971
# This is the by far the worst most effective script in this universe, but still reviews appreciated.
@vipulgupta2048
Copy link
Author

vipulgupta2048 commented Apr 20, 2019

TIME FOR THE CHALLENGE

Run the following code again, and try stopping the outcome.
Let me know what you observed, what you tried, how you solved it, why does it happen.

           
import requests
from lxml import html
from bs4 import BeautifulSoup
import os
import time

while True:
    r = BeautifulSoup(requests.get("https://in.bookmyshow.com/national-capital-region-ncr/movies/avengers-endgame/ET00090482").content, "html.parser").find("a", {"class":"showtimes btn _cuatro"})
    while(r!="None"):
        os.system("beep")
        print("Get the tickets Whatever it takes")
        # break
    else:
        print("Tickets aren't open yet")
        time.sleep(180)

@Ishaan28malik
Copy link

Ishaan28malik commented Apr 20, 2019

I tried running it

It is giving the same output and my kernel got pannicked , even I tried restarted the Kernel
At first it got started but then it got hung .

W*F!! ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment