Skip to content

amalpm615/utube

 
 

Repository files navigation

Simple Telegram Bot to Upload videos to Youtube written in Python3.

Contents

Info

This is a simple hobby project which i was really curious about to impliment. This is a Telegram bot which uses Youtube Data API v3 to upload videos to Youtube. This bot uses OAuth 2.0 to connect to your Youtube Channel.

Libraries Used

Pyrogram

Pyrogram is used to connect the bot with telegram servers.

Google Client API

Google Client API is used to connect the bot with Google and then with Youtube.

Setup

❗ This project requires Python3.7 (as this was written and tested with Python 3.7.3, try and see if it works with other versions)

Clone and setup virtual environment

$ git clone https://github.com/odysseusmax/utube.git

$ cd utube

$ virtualenv venv

$ source venv/bin/activate

Setup config.py

  • Head to Manage Apps and get your API_ID and API_HASH, and save it at the respective positions in config.py

  • Head to Google console, create a new project named Youtube Uploader and enable API'S AND SERVISES. Search for YOUTUBE DATA API v3 and enable the API. Go to Credentials page, select your project Youtube Uploader create a new credential with other as type. Copy the CLIENT_ID and CLIENT_SECRET and paste them to config.py

  • Head to Bot Father, create new bot and paste the bot token to BOT_TOKEN

  • Paste the bot owner's Telegram id to BOT_OWNER and add AUTH_USERS if you need others to use your bot.

  • All the contents of config.py must be kept secret as they contain sensitive informations

Install requirements

With all the above procedures done, its time to install our dependencies. Run :

$ pip3 install -r requirements.txt

Run bot

Lets run our bot for the first time!

$ python3 bot.py

If you did everything correctly, the bot should be running. Go do /start to see if the bot is live or not. Follow the instructions provided by bot to setup authorisation and to start uploading.

Or the easy way of directly deploying to heroku

Deploy

Status

This project is actively maintained and will continue so until I'm tired of it.

Special notes

  • With the Youtube Data API you are awarded with 10,000 points of requests. For one video upload it costs 1605 points, regardless of file size, which calculates to about 6 uploads daily. Once you have exhausted your daily points, you have to wait till daily reset. Resets happens at 0:00 PST, i.e. 12:30 IST. So make your uploads count.

  • Uploading copyright contents will leads to immediate blocking of the video, and will not be added to your MyVideos section of youtube. But still the video can be played directly through the link provided by the bot.

  • All the videos are uploaded as private. You may change it after youtube processes the video.

Screenshots

Upload

Video Tutorial

How To Make Telegram Bot For YouTube Videos Uploading

Video Tutorial

Contact

Share the FeedBack and Suggestions with me. You can contact me Here

About

Telegram Bot for Youtube upload

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%