Last active
          December 23, 2020 12:30 
        
      - 
      
 - 
        
Save boring-dragon/226881cfe0bfd38e8e6a8241d35a11eb to your computer and use it in GitHub Desktop.  
    Watch for movie tickets and get telegram notification when its available in cinema.mv. This is something I wrote up an year ago
  
        
  
    
      This file contains hidden or 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 requests | |
| import cfscrape | |
| import datetime | |
| import telebot | |
| import time | |
| from bs4 import BeautifulSoup | |
| # Telegram bot token | |
| bot_token = '' | |
| bot = telebot.TeleBot(token=bot_token) | |
| # Telegram channel id | |
| chatid = | |
| def scapp(): | |
| try: | |
| scraper = cfscrape.create_scraper() | |
| # Name of the movue | |
| name = "Aladdin" | |
| # Movie link | |
| response = scraper.get("https://cinema.mv/movie/aladdin") | |
| soup = BeautifulSoup(response.text, 'html.parser') | |
| paragraphs = soup.find("p").text | |
| date = datetime.datetime.now() | |
| if(paragraphs == "There are no screenings of this show available"): | |
| message = "Tickets are not available for {1}.. logged: {0}".format(date,name) | |
| print(message) | |
| except AttributeError as error: | |
| date = datetime.datetime.now() | |
| name = "Aladdin" | |
| message = "Tickets are available.. for {1} logged: {0}".format(date, name) | |
| bot.send_message(chatid, message) | |
| #print(message) | |
| def text(): | |
| x = 1 | |
| while x == 1: | |
| scapp() | |
| time.sleep(120) | |
| text() | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
            
Screenshot of the telegram notification