Skip to content

Rohan1279/cineplex-scraper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cineplex Movie Monitor

A Node.js application that monitors (cronjob) Cineplex BD for specific movie availability and sends notifications via ntfy to your mobile app (ntfy) when tickets become available.

Features

  • Monitors specific movies based on configurable criteria (title, actors, director, movie ID, category)
  • Sends instant notifications when target movies are found
  • Provides detailed show times and seat availability (%) information
  • Supports image attachments in notifications

Prerequisites

  • Node.js (v14 or higher)
  • ntfy server for notifications
  • Cron job scheduler (optional, for automated monitoring)

Installation

  1. Clone or download the project files

  2. Install dependencies:

    npm install
  3. Create a .env file in the project root:

    cp .env.example .env
  4. Configure the environment variables in .env (copy from request header):

    CINEPLEX_TOKEN=your_cineplex_api_token_here
    

ntfy Setup

Option 1: Self-hosted ntfy server

  1. Install ntfy server:

    # Ubuntu/Debian
    sudo apt install ntfy
  2. Start ntfy server:

    ntfy serve
  3. Update the notification server details in index.js:

    const ntfyReq = http.request({
      hostname: 'localhost',  // Change to your server IP
      port: 80,               // Change to your server port
      path: `/${ntfyTopic}`,
      method: 'POST',
      headers: headers
    });

Option 2: Using ntfy.sh (public service)

  1. Update the notification function in index.js:

    const ntfyReq = https.request({
      hostname: 'ntfy.sh',
      port: 443,
      path: `/${ntfyTopic}`,
      method: 'POST',
      headers: headers
    });
  2. Subscribe to notifications:

    # Mobile app or web browser
    # Visit: https://ntfy.sh/movie-alert
    
    # CLI subscription
    ntfy subscribe movie-alert

Configuration

Edit the MOVIE_DETECTION_CONSTANTS object in index.js to monitor different movies:

const MOVIE_DETECTION_CONSTANTS = {
  TITLES: ['superman'],
  ACTORS: ['david corenswet', 'nicholas hoult', 'rachel brosnahan'],
  GENRES: ['action', 'adventure', 'sci-fi'],
  IMAGE_KEYWORDS: ['superman'],
  MOVIE_ID: 1640,
  CATEGORY: '3D',
  DIRECTOR: ['james gunn']
};

Usage

Manual Execution

node index.js

Automated Monitoring with Cron

  1. Open crontab:

    crontab -e
  2. Add a cron job to run every 15 minutes:

    */15 * * * * cd /path/to/cineplex-scraper && node index.js >> /path/to/cineplex-scraper/log.txt 2>&1
  3. Alternative: Run every hour:

    @hourly /path/to/cineplex-scraper && node index.js >> /path/to/cineplex-scraper/log.txt 2>&1

Systemd Service (Alternative to Cron)

  1. Create a service file:

    sudo nano /etc/systemd/system/cineplex-monitor.service
  2. Add the following content:

    [Unit]
    Description=Cineplex Movie Monitor
    After=network.target
    
    [Service]
    Type=simple
    User=your_username
    WorkingDirectory=/path/to/cineplex-scraper
    ExecStart=/usr/bin/node index.js
    Restart=always
    RestartSec=900
    Environment=NODE_ENV=production
    
    [Install]
    WantedBy=multi-user.target
  3. Enable and start the service:

    sudo systemctl daemon-reload
    sudo systemctl enable cineplex-monitor.service
    sudo systemctl start cineplex-monitor.service

Notification Format

The application sends two types of notifications:

  1. Movie Found Alert: Basic notification when target movie is detected
  2. Detailed Show Times: Comprehensive information including:
    • Available show dates
    • Screen details
    • Show times with pricing
    • Seat availability with color-coded indicators

Troubleshooting

Token Expiration

  • The application automatically detects token expiration
  • Update the CINEPLEX_TOKEN in your .env file when notified

Common Issues

  1. Connection refused errors: Check ntfy server is running and accessible
  2. No movies found: Verify movie detection criteria in configuration
  3. API errors: Ensure token is valid and properly formatted

Logs

Check the console output or log file for detailed execution information.

Security Notes

  • Keep your .env file secure and never commit it to version control
  • The .gitignore file is configured to exclude sensitive files
  • Consider using environment variables in production deployments

About

A Node.js application that monitors (cronjob) Cineplex BD for specific movie availability and sends notifications

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors