pira/instagram

Telegram Instagram-DL bot based on MadelineProto

1.3.0 2024-08-04 05:20 UTC

This package is not auto-updated.

Last update: 2024-10-27 09:50:50 UTC


README

Welcome to the Instagram-DL Telegram Bot project! This bot allows you to download Instagram videos by simply sending a link through Telegram. It's built using MadelineProto.

Features

  • Download Instagram videos by sending the link to the bot.
  • Automatically handles valid URL checking.
  • Provides progress updates during the download process.

Installation

Requirements

  • PHP 8.2 or higher
  • Composer (optional, but recommended)

Setup

Method 1: Using Git and Composer

  1. Clone the repository:

    git clone https://github.com/code3-dev/Instagram-DL.git
    cd Instagram-DL
  2. Install dependencies:

    composer install
  3. Run the bot:

    php bot.php

Method 2: Using Composer Project Creator

  1. Create the project:

    composer create-project pira/instagram mybot
  2. Navigate to the project directory:

    cd mybot
  3. Run the bot:

    php bot.php

Method 3: Running bot.php Only

  1. Download the bot.php file:

    wget https://raw.githubusercontent.com/code3-dev/Instagram-DL/master/bot.php
  2. Run the bot:

    php bot.php

Usage

Once the bot is running, you can interact with it on Telegram. Here are some basic commands:

  • Start the bot:

    /start
    
  • Send an Instagram link: Simply paste the Instagram video link into the chat, and the bot will download and send the video back to you.

Project Structure

  • src/YTDL.php: This file contains the logic for handling the download requests from Instagram.
  • bot.php: The main entry point for running the Telegram bot.

Code Overview

Event Handlers

The bot uses event handlers to process commands and incoming messages. Here are some key components:

  • cmdStart: Handles the /start command and sends a welcome message.
  • cmdProcessUrl: Processes the Instagram URL sent by the user, validates it, and initiates the download process.
  • cmdUpload: Manages the file upload process, providing progress updates.

Main Function

The main function initializes the bot settings and starts the bot loop:

public static function main()
{
    $settings = new Settings;
    $settings->getConnection()->setMaxMediaSocketCount(1000);
    $settings->getPeer()->setFullFetch(false)->setCacheAllPeersOnStartup(false);

    self::startAndLoop('bot.madeline', $settings);
}

License

This project is licensed under the MIT License. See the LICENSE file for details.

Authors

Acknowledgments

Integration with PHP YTDL Library

This bot utilizes the YTDL class from the PHP YTDL Library to handle video downloads. Here is an overview of the YTDL class:

YTDL Class

The YTDL class handles the configuration and sending of requests to a video downloading API. It allows you to set various parameters for downloading videos or audio, such as video quality, codec, audio format, and filename pattern. The class provides methods to enable or disable specific features like audio-only downloads, full audio from TikTok videos, and metadata options.

Sources