Git Product home page Git Product logo

cinema-bot's Introduction

Async Cinema Searcher Bot

This project implements an asynchronous Telegram bot for searching movies.

Initial request (keywords) is made in google with additional word imdb. Then the most frequent movie_id is selected from response using Soup. The next step is collecting data associated with movie. For this goal is applied IMDB API. Finally, request and movie title are saved in database. All requests and replies for messages support concurrency.

The bot supports the history of requests by using SQLite.

Getting started

Prerequisites

It is strongly recommended to use Python 3.10 and above versions.

The script requires libraries aiogram and aiohttp for concurrent execution. Necessary packages and versions can be installed with the following command

pip install -r requirements.txt

Usage

After cloning the repository and installing requirements two tokens are needed.

  • Token for Telegram bot. It can be taken from BotFather.
  • Token for IMDb API. It will be available after registration here.

Then tokens are placed into environment variables

export BOT_TOKEN=<your bot token>
export IMDB_TOKEN=<your imdb token>
python3 bot.py
# or simpler
BOT_TOKEN=<your bot token> IMDB_TOKEN=<your imdb token> python3 bot.py

Example

Possible sequence of messages (U: user, B bot)

    U: /start
    B: [welcome message]
    U: some keywords
    B: [title, poster, duration, description, links, etc.]
    U: /history
    B: [history of requests]
    U: /stats
    B: [statistics of requests]
    U: /delete request
    B: Deleted 2 items. # request has been deleted from the database
    U: /link title year
    B: [link to movie description on IMDb]
    U: /info movie_id (or link)  # generating description without searching by keywords
    B: [the same with 4th line]

Note: History depends on user id (independent for everyone). It is saved on HDD and can be deleted only by /delete and /clear commands.

During the next several months bot is available here.

cinema-bot's People

Watchers

Alexander Kutsakov avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.