Skip to content

cksharma2468/Imdb_bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

IMDb Rating Telegram Bot

A simple Node.js Telegram bot that returns IMDb ratings for movies and series using the OMDb API.

You send the bot a title (like Inception or Breaking Bad) and it replies with the title, year, type (movie/series), IMDb rating, and a link to the IMDb page. You can try it live at @ImdbRatings_bot.


Features

  • Get IMDb rating for a movie or series by title.
  • Uses the free OMDb API as the data source. [web:114]
  • Built with:
    • Node.js
    • node-telegram-bot-api
    • axios
    • dotenv

Getting Started

These steps show how to run the bot locally on your own machine.

1. Prerequisites

  • Node.js (v16 or later recommended) installed on your system. [web:37]
  • A Telegram account.

2. Create a Telegram bot and get the token

If you want to run your own copy of this bot (instead of using @ImdbRatings_bot):

  1. Open Telegram and start a chat with @BotFather.
  2. Send /start if needed.
  3. Send /newbot and follow the instructions:
    • Choose a display name.
    • Choose a unique username ending with bot. [web:71]
  4. BotFather will give you an HTTP API token. Save this; you will use it as TELEGRAM_BOT_TOKEN.

3. Get an OMDb API key

  1. Go to https://www.omdbapi.com/apikey.aspx. [web:117]
  2. Request a free API key and wait for it to be activated.
  3. You will use this as OMDB_API_KEY.

Local Setup

  1. Clone this repository:

    git clone https://github.com/<your-username>/Imdb_bot.git
    cd Imdb_bot
  2. Install dependencies:

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

    TELEGRAM_BOT_TOKEN=your_telegram_bot_token_here
     OMDB_API_KEY=your_omdb_api_key_here
    
    

The project uses the dotenv package to load these values into process.env. [web:64][web:57]

  1. Start the bot:

    npm start

If everything is configured correctly, the process will start without errors and keep running.

  1. Talk to your bot on Telegram:
  • Open Telegram.
  • Search for your bot’s username (for this repo it is @ImdbRatings_bot).
  • Click Start and send a title like:
    • Node.js
    • Inception
    • Interstellar
    • Breaking Bad The bot should respond with the IMDb rating and a link.

How It Works (High Level)

  1. The bot uses long polling to receive new messages from Telegram (via node-telegram-bot-api). [web:108]

  2. When a user sends a movie/series name: -The bot calls the OMDb API endpoint https://www.omdbapi.com/ with the title and your API key. [web:114] -OMDb returns information including: -Title -Year -Type (movie/series/episode) -imdbRating -imdbID [web:26]

  3. The bot formats this data into a message and sends it back to the user.


Environment Variables

The project expects these variables:

-TELEGRAM_BOT_TOKEN– your Telegram bot token from BotFather.

-OMDB_API_KEY – your OMDb API key.

When deploying to platforms like Railway or Render, set these values in the platform’s environment/variables section instead of using a .env file. [web:99][web:101]

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors