Skip to content

A telegram bot to download mega.nz links. (made with pyrogram).

License

Notifications You must be signed in to change notification settings

Rajbhaiya/mega-link-downloader-bot

 
 

Repository files navigation

Mega Link Downloader Bot

This is a telegram bot to download mega.nz links and return them as files/videos - Made by a 100% noob!

(When I mean noob I really mean noob!)

You can find a live version of this bot in telegram as @mega_downloader_robot

Created with ❤️ by @xmysteriousx as a part of @mysterious_uploader_robot

Please be kind to star and fork this repo!✨😇


Features 💫

  • Mega accounts are not needed!
  • Uses two download engines for downloading links!
  • Speed improved with heroku and vps too!
  • Parallel downloads are supported! (This means many users can use the bot at the same time. 😇)
  • Multitasking is also supported! (This means You (owner) and telegram users who you set as auth users will be able to download multiple links at the same time! 😋)
  • Custom thumbnail support!
  • Custom caption support!
  • Ban unwanted users!
  • See your bot's user count!
  • Broadcast any message to every user of your bot!
  • Ability to download any file under 5GB! (If you provide a pro/business account when deploying there will be no file size limits! 😍)

Notes :-

  1. Due to telegram API limits I can't upload files which are bigger than 2GB so such files will be spliited and uploaded to you!
  2. Quota limits can occur if you don't provide a pro/business account!
  3. Folder support is not implemented yet but can be added in the near future!

Deploying Methods

Deploying to Heroku
  • Examples of needed bot variables are mentioned below in this readme!

Note :- Downloads are speed on heroku too! 😍


Deploy

Deploying on a VPS

Make an Ubuntu 20.04 (LTS) x64 vps! (All the commands below are given assuming that you use a Ubuntu 20.04 (LTS) x64 vps!)

  • Then execute the below commands. 👇
sudo apt update
sudo apt upgrade
apt-get update
apt-get install tmux
apt install meson
sudo apt-get install libtool libglib2.0-dev gobject-introspection libgmp3-dev nettle-dev asciidoc glib-networking openssl libcurl4-openssl-dev libssl-dev
git clone https://github.com/XMYSTERlOUSX/megatools
cd megatools
meson b
ninja -C b
sudo ninja -C b install
cd
wget https://mega.nz/linux/MEGAsync/xUbuntu_20.04/amd64/megacmd-xUbuntu_20.04_amd64.deb
sudo apt install ./megacmd-xUbuntu_20.04_amd64.deb

(Ignore the warning "Download is performed unsandboxed as root as file" if it is shown...Continue with the other steps now!)

tmux

Now there are two methods to go further!

  • Method 1

    • Fork my repo. In the repo go inside to the sample_config.py and copy all the code in it. In your forked repo, create a file named config.py and paste the whole code in it.
    • Then edit the values in it with your values! (Inside your config.py file you will see the examples of how to edit the fields.)
    • Then execute the below commands. 👇
git clone You_forked_repo_url
apt install python3-pip
apt install ffmpeg
cd mega-link-downloader-bot
pip3 install -r requirements.txt
python3 bot.py

Now If you did everything correctly bot will be running successfully! 🥳

  • Method 2

    • Execute the below commands. 👇
git clone https://github.com/XMYSTERlOUSX/mega-link-downloader-bot
apt install python3-pip
apt install ffmpeg
cd mega-link-downloader-bot
pip3 install -r requirements.txt
cp sample_config.py config.py
nano config.py
  • Now you will be inside the config.py file.
  • Then edit the values in it with your values! (Inside your config.py file you will see the examples of how to edit the fields.)
  • (For pasting letters, copy any value you want and take the curser to the place you want by arrow keys and right click the mouse! 😅)
  • After editing all with appropriate values as mentioned in the config file press Ctrl + X from your keyboard.
  • Then press y in your keyboard.
  • Then execute the below command. 👇
python3 bot.py

Now If you did everything correctly, the bot will be running successfully! 🥳


Variables

  • API_ID - Get this value from https://my.telegram.org/apps
  • API_HASH - Get This Value from https://my.telegram.org/apps
  • TG_BOT_TOKEN - Make a bot from https://t.me/BotFather and enter the token here.
  • Mega_email - This is not necessary! Enter your mega email only if you have a mega.nz account with pro/business features. (Used for downloading links with the download engine 'MEGAcmd' which is used in this repository.)
  • Mega_password - This is not necessary! Enter your mega password only if you have a mega.nz account with pro/business features. (Used for downloading links with the download engine 'MEGAcmd' which is used in this repository.)
  • Bot_username - Your bot's telegram username. (must enter with '@' in the front of the username.)
  • AUTH_USERS - Id's of the telegram users, who you want to allow for multitasking - downloading multiple links at once!
  • OWNER_ID - Your(owner's) telegram id
  • REDIS_URI - Get This Value from http://redislabs.com/try-free (If you don't know how to obtain these values a complete video tutorial is available here:- https://t.me/botzupdate/5)
  • REDIS_PASS - Get This Value from http://redislabs.com/try-free (If you don't know how to obtain these values a complete video tutorial is available here:- https://t.me/botzupdate/5)

Bot Commands

Normal User Commands
  • /start - To check if the bot is alive!
  • /help - To get the detailed help guide of using the bot!
  • /deletethumbnail - To delete your saved custom thumbnail!
Admin Commands
  • /mega_ini - If you are the bot owner (who deploys the bot) and have a pro/business account; In addition to providing your mega credentials in config variables when deploying the bot, you will have to create a mega.ini file for using with the download engine 'megatools' which is used in this repository. Going through this step is essential if you are willing to avoid quota limits when downloading links!

Create a new text file in notepad or from any other method. Copy the code shown below and paste it in your newly created text file. Replace the values with your actual credentials! Then save the file as "mega.ini"

[Login]
Username = your-mega-email-without-inverted-commas
Password = your-mega-password-without-inverted-commas

[Network]
# 1MiB/s
SpeedLimit = 0

[UI]
Colors = true

Note :- In the above code change only the "Username" and the "Password" with your credentials. Keep others exactly as it is and save the file as "mega.ini"

Now send your "mega.ini" file to your bot and as a reply to it send the command /mega_ini

  • /black - To ban unwanted users from the bot!
    (Syntax of sending the commnad to the bot is:- /black userid)

  • /unblack - To unban banned users from the bot!
    (Syntax of sending the commnad to the bot is:- /unblack userid)

  • /lisblack - To get the telegram id list of banned user's from the bot!

  • /broadcast - To broadcast a message to all the users of the bot!
    (Syntax of sending the commnad to the bot is:- /broadcast as a reply to the message that you want to broadcast!)

  • /stats - To get the total number of users who has used your bot!


Reason for making this open source :-

For the help of any guy like me in this world who is wondering how to make a bot for downloading mega links, or for whoever that is finding a code to download mega links; thought to make this public. 😇❤️


Credits, and Thanks to

Project written and created by - XMYSTERIOUSX


LICENSE

  • GPLv3

About

A telegram bot to download mega.nz links. (made with pyrogram).

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 97.5%
  • Dockerfile 2.5%