Skip to content

This project is a Telegram bot that downloads Instagram stories and stores them in a SQLite database. It allows users to download stories from Instagram profiles, view downloaded stories, and export the data as a CSV file.

License

Notifications You must be signed in to change notification settings

vin0x/ig-stories-telegram-db

Repository files navigation

Instagram Stories Downloader Bot

  • README em Português, clique aqui -> vin0x-brasil

  • README in English, click here -> vin0x-windows

About

This project is a Telegram bot that downloads Instagram stories and stores them in a SQLite database. It allows users to download stories from Instagram profiles, view downloaded stories, and export the data as a CSV file.

Used during the Paris 2024 Olympic Games to connect fans with athletes Instagram profiles and build a database of their memorable moments, this sample version of the project uses a smaller dataset to demonstrate key features with reduced complexity. Feel free to adapt this bot to suit your specific use case and research needs.

Features

  • Download Instagram stories from public profiles
  • View downloaded stories
  • Retrieve stories by Instagram user or Telegram user
  • Saved stories are stored in a SQLite table
  • Export stories data to a CSV file

Example

Example of the data that was stored in the stories.db table in SQLite, converted to .csv to be sent via Telegram.

Requirements

  • Python 3.x 🐍🐍
  • Telegram Account
  • python-telegram-bot library
  • instaloader library
  • sqlite3 library (included with Python)
  • pandas library (optional for data manipulation using .csv file)

Setup

1. Clone the Repository

git clone https://github.com/yourusername/instagram-stories-downloader-bot.git
cd instagram-stories-downloader-bot

2. Install Dependencies

Make sure you have pip installed, then run:

pip install python-telegram-bot instaloader pandas

3. Configure the Bot

  1. Create a Telegram Bot:

    • Use BotFather on Telegram to create a new bot and get the API key.
    • Replace the api_key in bot.py with your bot’s API key.
  2. Create a Session File for Instaloader:

    • Use instaloader to log in and create a session file or log in Instagram using Firefox and run the importfirefoxsession.py.
    • Run instaloader --login your_username and follow the prompts.
    • Save the session file with the name session-topcortessecos or modify the code to match your session file name.

4. Run the Bot

Start the bot with:

python telegrambot.py

The bot will now be running and listening for commands on Telegram.

Commands

  • /downloadstories - Download all available stories from an Instagram user. Type the username without @.
  • /getmystories - Retrieve your downloaded stories.
  • /getstories - Get stories for a specific Instagram user. Type the username to fetch stories.
  • /viewtable - View the entire stories table as a CSV file.

CSV Export

The /viewtable command generates a CSV file with the following columns:

  • ID
  • Telegram User ID
  • Instagram User
  • File Path
  • Time Posted
  • Country

The file is sent as a document through Telegram.

License

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

Contact

If you have any questions, feel free to reach out vinigoes@outlook.com or vinox_quente on Discord.

About

This project is a Telegram bot that downloads Instagram stories and stores them in a SQLite database. It allows users to download stories from Instagram profiles, view downloaded stories, and export the data as a CSV file.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages