GithubHelp home page GithubHelp logo

tgbot-collection / ytdlbot Goto Github PK

View Code? Open in Web Editor NEW
552.0 17.0 530.0 2.66 MB

Download videos from Youtube and other platforms through a Telegram Bot

License: Apache License 2.0

Dockerfile 0.38% Python 96.57% Makefile 0.79% Shell 2.23% Procfile 0.03%

ytdlbot's Introduction

ytdlbot

docker image

YouTube Download Bot🚀🎬⬇️

This Telegram bot allows you to download videos from YouTube and other supported websites.

Celery mode won't work and I don't know why. So I may shutting down this bot soon.

Usage

Just send a link directly to the bot.

Supported websites

  • YouTube 😅

  • Any websites supported by yt-dlp

    Specific link downloader (Use /spdl for these links)

    • Instagram (Videos, Photos, Reels, IGTV & carousel)
    • Pixeldrain
    • KrakenFiles
    • Terabox (file/folders) (you need to add cookies txt in ytdlbot folder with name) terabox.txt.

Features

  1. fast download and upload.
  2. ads free
  3. support progress bar
  4. audio conversion
  5. playlist download
  6. payment support: afdian, buy me a coffee, Telegram Payment and Tron(TRX)
  7. different video resolutions
  8. sending as file or streaming as video
  9. celery worker distribution - faster than before. NOT WORKING
  10. subscriptions to YouTube Channels
  11. cache mechanism - download once for the same video.
  12. instagram posts(only available for my bot)
  13. 4 GiB file size support with Telegram Premium
  14. History and inline mode support
  15. Supports multiple download engines (yt-dlp, aria2, requests).

Note

For users of my official bot
Files larger than 2 GiB will be automatically uploaded by me(My Premium Account). By utilizing our service for such downloads, you consent to this process.
That means I know who you are and what you download.
Rest assured that we handle your personal information with the utmost care.

Limitations

Due to limitations on servers and bandwidth, there are some restrictions on this free service.

  • Each user is limited to 10 free downloads per 24-hour period
  • Maximum of three subscriptions allowed for YouTube channels.
  • Files bigger than 2 GiB will require at least 1 download token.

If you need more downloads, you can buy download tokens.

Thank you for using the official bot.

Screenshots

Normal download

Instagram download

celery NOT WORKING

How to deploy?

This bot can be deployed on any platform that supports Python.

Run natively on your machine

To deploy this bot, follow these steps:

  1. Install bot dependencies

    • Install Python 3.10 or a later version, FFmpeg.
    • (optional)Aria2 and add it to the PATH.
  2. Clone the code from the repository and cd into it.

    • git clone https://github.com/tgbot-collection/ytdlbot
    • cd ytdlbot/
  3. Creating a virtual environment and installing required modules in Python.

    • python -m venv venv
    • source venv/bin/activate   # Linux
      #or
      .\venv\Scripts\activate   # Windows
    • pip install --upgrade pip
    • pip install -r requirements.txt
  4. Set the environment variables TOKEN, APP_ID, APP_HASH, and any others that you may need.

    • Change values in ytdlbot/config.py or
    • Use export APP_ID=111 APP_HASH=111 TOKEN=123
  5. Finally, run the bot with

    • python ytdl_bot.py

Docker

One line command to run the bot

docker run -e APP_ID=111 -e APP_HASH=111 -e TOKEN=370FXI bennythink/ytdlbot

Heroku

Deploy to heroku

Deploy to Heroku

If you are having trouble deploying, you can fork the project to your personal account and deploy it from there.

Starting November 28, 2022, free Heroku Dynos, free Heroku Postgres, and free Heroku Data for Redis® plans will no longer be available. Heroku Announcement

Complete deployment guide for docker-compose

  • contains every functionality
  • compatible with amd64 and arm64

1. get docker-compose.yml

Download docker-compose.yml file to a directory

2. create data directory

mkdir data
mkdir env

3. configuration

3.1. set environment variables

vim env/ytdl.env

You can configure all the following environment variables:

  • WORKERS: workers count for celery NOT WORKING
  • PYRO_WORKERS: number of workers for pyrogram, default is 100
  • APP_ID: REQUIRED, get it from https://core.telegram.org/
  • APP_HASH: REQUIRED
  • TOKEN: REQUIRED
  • REDIS: REQUIRED if you need VIP mode and cache ⚠️ Don't publish your redis server on the internet. ⚠️
  • EXPIRE: token expire time, default: 1 day
  • ENABLE_VIP: enable VIP mode
  • OWNER: owner username
  • AUTHORIZED_USER: only authorized users can use the bot
  • REQUIRED_MEMBERSHIP: group or channel username, user must join this group to use the bot
  • ENABLE_CELERY: celery mode, default: disable NOT WORKING
  • BROKER: celery broker, should be redis://redis:6379/0 NOT WORKING
  • MYSQL_HOST:MySQL host
  • MYSQL_USER: MySQL username
  • MYSQL_PASS: MySQL password
  • AUDIO_FORMAT: default audio format
  • ARCHIVE_ID: forward all downloads to this group/channel
  • IPv6 = os.getenv("IPv6", False)
  • ENABLE_FFMPEG = os.getenv("ENABLE_FFMPEG", False)
  • PROVIDER_TOKEN: stripe token on Telegram payment
  • PLAYLIST_SUPPORT: download playlist support
  • M3U8_SUPPORT: download m3u8 files support
  • ENABLE_ARIA2: enable aria2c download
  • FREE_DOWNLOAD: free download count per day
  • TOKEN_PRICE: token price per 1 USD
  • GOOGLE_API_KEY: YouTube API key, required for YouTube video subscription.
  • RCLONE_PATH: rclone path to upload files to cloud storage
  • TMPFILE_PATH: tmpfile path(file download path)
  • TRONGRID_KEY: TronGrid key, better use your own key to avoid rate limit
  • TRON_MNEMONIC: Tron mnemonic, the default one is on nile testnet.
  • PREMIUM_USER: premium user ID, it can help you to download files larger than 2 GiB

3.2 Set up init data

If you only need basic functionality, you can skip this step.

3.2.1 Create MySQL db

Required for VIP(Download token), settings, YouTube subscription.

docker-compose up -d
docker-compose exec mysql bash

mysql -u root -p

> create database ytdl;

3.2.2 Setup flower db in ytdlbot/ytdlbot/data

Required if you enable celery and want to monitor the workers. NOT WORKING

{} ~ python3
Python 3.9.9 (main, Nov 21 2021, 03:22:47)
[Clang 12.0.0 (clang-1200.0.32.29)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import dbm;dbm.open("flower","n");exit()

3.3 Tidy docker-compose.yml

In flower service section, you may want to change your basic authentication username password and publish port.

You can also limit CPU and RAM usage by adding a deploy key, use --compatibility when deploying.

    deploy:
      resources:
        limits:
          cpus: '0.5'
          memory: 1500M

4. run

4.1. standalone mode

If you only want to run the mode without any celery worker and VIP mode, you can just start ytdl service

docker-compose up -d ytdl

4.2 VIP mode

You'll have to start MySQL and redis to support VIP mode, subscription and settings.

docker-compose up -d mysql redis ytdl

4.3 Celery worker mode

NOT WORKING Firstly, set ENABLE_CELERY to true. And then, on one machine:

docker-compose up -d

On the other machine:

docker-compose -f worker.yml up -d

⚠️ You should not publish Redis directly on the internet. ⚠️

4.4 4 GiB Support

  1. Subscribe to Telegram Premium
  2. Setup user id PREMIUM_USER in ytdl.env
  3. Create session file by running python premium.py
  4. Copy the session file premium.session to data directory
  5. docker-compose up -d premium

kubernetes

refer guide here kubernetes

Command

start - Let's start
about - What's this bot?
help - Help
spdl - Use to download specific link downloader links
ytdl - Download video in group
leech - Download file using aria2
direct - Download file using requests
settings - Set your preference
buy - Buy token
sub - Subscribe to YouTube Channel
unsub - Unsubscribe from YouTube Channel
sub_count - Check subscription status, owner only.
uncache - Delete cache for this link, owner only.
purge - Delete all tasks, owner only.
ping - Ping the Bot
stats - Bot running status
show_history - Show download history
clear_history - Clear download history

Test data

Tap to expand

Test video

https://www.youtube.com/watch?v=BaW_jenozKc

Test Playlist

https://www.youtube.com/playlist?list=PL1Hdq7xjQCJxQnGc05gS4wzHWccvEJy0w

Test twitter

https://twitter.com/nitori_sayaka/status/1526199729864200192 https://twitter.com/BennyThinks/status/1475836588542341124

Test instagram

Test Pixeldrain

https://pixeldrain.com/u/765ijw9i

Test KrakenFiles

https://krakenfiles.com/view/oqmSTF0T5t/file.html

Test TeraBox

https://terabox.com/s/1mpgNshrZVl6KuH717Hs23Q


Donation

Found this bot useful? You can donate to support the development of this bot.

Donation Platforms

Stripe

You can choose to donate via Stripe.

USD(Card, Apple Pay and Google Pay) CNY(Card, Apple Pay, Google Pay and Alipay)
USD CNY

Cryptocurrency

TRX or USDT(TRC20)

TF9peZjC2FYjU4xNMPg3uP4caYLJxtXeJS

License

Apache License 2.0

ytdlbot's People

Contributors

adityabotsex avatar bartixxx32 avatar bennythink avatar dependabot[bot] avatar deusyu avatar gengjiawen avatar jasonkhew96 avatar kran0 avatar n0vad3v avatar nasirhossainakash avatar oelberte avatar qunas101 avatar sanujans avatar tomyangsh avatar vuisme avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ytdlbot's Issues

Heroku MYSQL

how to add heroku to my sql is there any tutorial

Upload downloaded file before downloading entire playlist and private video bug

First off, thanks for this amazing bot. my issues: 1) when downloading a playlist contating for example 50 videos, currently bot downloads all 50 videos first, then starts uploading one by one. If possible, Instead if it is made to upload each video first before beginning next download of second video, space consumption in local drive is minimised and will bw hwlpful for those with limited drive space (like me)
2) If there is a private or deleted video in a playlist, all the downloads stop. instead if there is an ability to skip those videos and download and upload others, it will be more useful. Thanks.

About Heroku

Through the background observation, it is found that this demo has been running all tims, consuming a lot of free time, so may I add startup parameters to start when it becomes used

Bot Freezing

Screenshot_20220219-170558_Plus

the bot sometimes freezes like this, the process is interrupted like this

Failed to download from twitter, also ping button doesn't seem to work

I got an error when trying to download twitter video, I got:

Traceback (most recent call last):
  File "/app/downloader.py", line 97, in ytdl_download
    ydl.download([url])
  File "/app/.heroku/python/lib/python3.9/site-packages/youtube_dl/YoutubeDL.py", line 2068, in download
    res = self.extract_info(
  File "/app/.heroku/python/lib/python3.9/site-packages/youtube_dl/YoutubeDL.py", line 808, in extract_info
    return self.__extract_info(url, ie, download, extra_info, process)
  File "/app/.heroku/python/lib/python3.9/site-packages/youtube_dl/YoutubeDL.py", line 815, in wrapper
    return func(self, *args, **kwargs)
  File "/app/.heroku/python/lib/python3.9/site-packages/youtube_dl/YoutubeDL.py", line 847, in __extract_info
    return self.process_ie_result(ie_result, download, extra_info)
  File "/app/.heroku/python/lib/python3.9/site-packages/youtube_dl/YoutubeDL.py", line 881, in process_ie_result
    return self.process_video_result(ie_result, download=download)
  File "/app/.heroku/python/lib/python3.9/site-packages/youtube_dl/YoutubeDL.py", line 1692, in process_video_result
    self.process_info(new_info)
  File "/app/.heroku/python/lib/python3.9/site-packages/youtube_dl/YoutubeDL.py", line 1976, in process_info
    success = dl(filename, info_dict)
  File "/app/.heroku/python/lib/python3.9/site-packages/youtube_dl/YoutubeDL.py", line 1915, in dl
    return fd.download(name, info)
  File "/app/.heroku/python/lib/python3.9/site-packages/youtube_dl/downloader/common.py", line 366, in download
    return self.real_download(filename, info_dict)
  File "/app/.heroku/python/lib/python3.9/site-packages/youtube_dl/downloader/hls.py", line 78, in real_download
    return fd.real_download(filename, info_dict)
  File "/app/.heroku/python/lib/python3.9/site-packages/youtube_dl/downloader/external.py", line 35, in real_download
    retval = self._call_downloader(tmpfilename, info_dict)
  File "/app/.heroku/python/lib/python3.9/site-packages/youtube_dl/downloader/external.py", line 227, in _call_downloader
    self.report_error('m3u8 download detected but ffmpeg or avconv could not be found. Please install one.')
  File "/app/.heroku/python/lib/python3.9/site-packages/youtube_dl/downloader/common.py", line 165, in report_error
    self.ydl.report_error(*args, **kargs)
  File "/app/.heroku/python/lib/python3.9/site-packages/youtube_dl/YoutubeDL.py", line 628, in report_error
    self.trouble(error_message, tb)
  File "/app/.heroku/python/lib/python3.9/site-packages/youtube_dl/YoutubeDL.py", line 598, in trouble
    raise DownloadError(message, exc_info)
youtube_dl.utils.DownloadError: ERROR: m3u8 download detected but ffmpeg or avconv could not be found. Please install one.

also on ping button I got log on heroku like this:

2021-08-16T00:16:19.695433+00:00 app[worker.1]: 2021-08-16 00:16:19,695 - ytdl.py [INFO]: Download complete.
2021-08-16T00:22:06.411351+00:00 app[worker.1]: 2021-08-16 00:22:06,410 - dispatcher.py [ERROR]: [400 MESSAGE_TOO_LONG]: The message text is over 4096 characters (caused by "messages.SendMessage")
2021-08-16T00:22:06.411360+00:00 app[worker.1]: Traceback (most recent call last):
2021-08-16T00:22:06.411361+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.9/site-packages/pyrogram/dispatcher.py", line 219, in handler_worker
2021-08-16T00:22:06.411362+00:00 app[worker.1]:     await self.loop.run_in_executor(
2021-08-16T00:22:06.411363+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.9/concurrent/futures/thread.py", line 52, in run
2021-08-16T00:22:06.411363+00:00 app[worker.1]:     result = self.fn(*self.args, **self.kwargs)
2021-08-16T00:22:06.411363+00:00 app[worker.1]:   File "/app/ytdl.py", line 52, in ping_handler
2021-08-16T00:22:06.411364+00:00 app[worker.1]:     client.send_message(chat_id, bot_info)
2021-08-16T00:22:06.411364+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.9/site-packages/pyrogram/sync.py", line 50, in async_to_sync_wrap
2021-08-16T00:22:06.411365+00:00 app[worker.1]:     return asyncio.run_coroutine_threadsafe(coroutine, loop).result()
2021-08-16T00:22:06.411365+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.9/concurrent/futures/_base.py", line 445, in result
2021-08-16T00:22:06.411366+00:00 app[worker.1]:     return self.__get_result()
2021-08-16T00:22:06.411366+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.9/concurrent/futures/_base.py", line 390, in __get_result
2021-08-16T00:22:06.411367+00:00 app[worker.1]:     raise self._exception
2021-08-16T00:22:06.411367+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.9/site-packages/pyrogram/methods/messages/send_message.py", line 125, in send_message
2021-08-16T00:22:06.411368+00:00 app[worker.1]:     r = await self.send(
2021-08-16T00:22:06.411368+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.9/site-packages/pyrogram/methods/advanced/send.py", line 77, in send
2021-08-16T00:22:06.411369+00:00 app[worker.1]:     r = await self.session.send(
2021-08-16T00:22:06.411369+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.9/site-packages/pyrogram/session/session.py", line 425, in send
2021-08-16T00:22:06.411369+00:00 app[worker.1]:     return await self._send(data, timeout=timeout)
2021-08-16T00:22:06.411370+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.9/site-packages/pyrogram/session/session.py", line 395, in _send
2021-08-16T00:22:06.411370+00:00 app[worker.1]:     RPCError.raise_it(result, type(data))
2021-08-16T00:22:06.411370+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.9/site-packages/pyrogram/errors/rpc_error.py", line 78, in raise_it
2021-08-16T00:22:06.411371+00:00 app[worker.1]:     raise getattr(
2021-08-16T00:22:06.411371+00:00 app[worker.1]: pyrogram.errors.exceptions.bad_request_400.MessageTooLong: [400 MESSAGE_TOO_LONG]: The message text is over 4096 characters (caused by "messages.SendMessage")

Overall this is a good work.

400 API_ID_INVALID(api_id/api_hash combination is invalid)

Hi, thanks for offering so amazing bot. Unfortunately I met a problem.
I got my api_id and api_hash from https://my.telegram.org/apps, checked many times and I'm sure they are right.

App api_id:13******
App api_hash:9e7**************************e21
DC 2

I put them to app.json and ran ytdl_bot.py, finally an error occurred:

pyrogram.errors.exceptions.bad_request_400.ApiIdInvalid: Telegram says: [400 API_ID_INVALID] - The api_id/api_hash combination is invalid (caused by "auth.ImportBotAuthorization")

I've googled that, turned out to be Telegram's fault. API ID that over 5 digits may goes wrong in combination. Telegram said they've fixed this problem but not well for me.

LonamiWebs/Telethon#46
LonamiWebs/Telethon#836
steavy29/Telegram.Net#27

Is there anything I did wrong?Any suggestions ?
By the way, my api_id is 8 digit.

Video title

Hello programmers!

Could you please add a title to all of the videos, like the youtube title it has?

Playlist option

As I already asked, follow your instructions - THIS IS A NOTE FOR playlist option support.

Thank you very much for that effort!

Tik tok issue

Hi, i am getting this error after sending link to tik tok.
Is there any way to fix it ?
IMG_20220106_132514

Feature request

Feature request:

  • #50
  • 2. Set limit for selfhosted bot to do only one url at once, for example i send to it links in order
youtube.com/1
youtube.com/2
youtube.com/3

And it will process one by one to send output files in good order, not sending smaller first when doing concurrent downloads.

Feature request : direct audio and metadata edit

It would be really cool if we can simply download only the audio by using a specific command (such as /audio or /a) with the link on the message, or by replying to a supported link with that command

Next enhancement that can be done is the ability to set custom metadata for the download we want (would work only for audio)
Like having a /meta command, then we specify the Artist and the Title
Example : /meta Roy Knox:Until The End (here the separator is a colon, but it could be something else)
I say this because when we have a mp3 file, Telegram shows the title and artist of the file
Can work as shown here

Add this please

Please add quality (resolution) select buttons which appear after sending link
Second add heroku deploy button
Third if u can please add Google drive upload options

Heroku Support

Hi, I checked a lot of bots that are not working for Dailymotion but only yours is working. Can you please make it possible to deploy to Heroku? As I know nothing python so it's not possible for me to add Heroku support. I don't want to abuse the bot hosted by yourself 😅

Environment variable AUTHORIZED_USER has no effect

In “config.py” file, the code in line 43 to get the environment variable AUTHORIZED_USER is

#limitation settings
AUTHORIZED_USER: "str" = os.getenv("AUTHORIZED", "")

However, the guide says the environment variable to be set is AUTHORIZED_USER, which will invalidate the user limitation function.
I thought it may be better to have the same description on both sides.

Geo blocking

May i ask how to fix the geo blocking problem?

Instagram issue

Hi so when i send link to Instagram video, bot says : "You need to log in to access this content. Use --cookies, --username and --password, or --netrc to provide account credentials"

Is there a way to put the login and pass data to script ?

REDIS

I deployed the bot on heroku but it didn't asked me to fill "REDIS" variable.

But I know how to add it manually but I don't know what should I fill in that variable value.

Can you help me?

Bot going not well

It seems the bot doesn't run well on my server. I don't know where goes wrong.
My server OS is CentOS 8.5,python's version is 3.6.8

when I send '/about' command ,the bot replies the repo link normally.
when send '/ping' command , error message is :

Telegram says: [400 MESSAGE_TOO_LONG] - The message text is over 4096 characters (caused by "messages.SendMessage")

When send a video link or '/setting' command , error message is as follows:

[2022-04-07 09:20:54 dispatcher.py:136 I] Started 100 HandlerTasks
[2022-04-07 09:21:01 dispatcher.py:235 E] module 'six' has no attribute 'ensure_str'
Traceback (most recent call last):
  File "/usr/local/lib64/python3.6/site-packages/pyrogram/dispatcher.py", line 228, in handler_worker
    *args
  File "/usr/lib64/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "ytdl_bot.py", line 76, in wrapper
    return func(client, message)
  File "ytdl_bot.py", line 265, in download_handler
    red.user_count(chat_id)
  File "/root/ytdlbot/ytdlbot/db.py", line 133, in user_count
    self.r.hincrby("metrics", user_id)
  File "/usr/local/lib/python3.6/site-packages/redis/commands/core.py", line 3717, in hincrby
    return self.execute_command("HINCRBY", name, key, amount)
  File "/usr/local/lib/python3.6/site-packages/redis/client.py", line 1180, in execute_command
    lambda error: self._disconnect_raise(conn, error),
  File "/usr/local/lib/python3.6/site-packages/redis/retry.py", line 45, in call_with_retry
    return do()
  File "/usr/local/lib/python3.6/site-packages/redis/client.py", line 1178, in <lambda>
    conn, command_name, *args, **options
  File "/usr/local/lib/python3.6/site-packages/redis/client.py", line 1152, in _send_command_parse_response
    conn.send_command(*args)
  File "/usr/local/lib/python3.6/site-packages/redis/connection.py", line 796, in send_command
    self.pack_command(*args), check_health=kwargs.get("check_health", True)
  File "/usr/local/lib/python3.6/site-packages/redis/connection.py", line 777, in send_packed_command
    self._sock.sendall(item)
  File "/usr/local/lib/python3.6/site-packages/fakeredis/_server.py", line 836, in sendall
    self._parser.send(data)
  File "/usr/local/lib/python3.6/site-packages/fakeredis/_server.py", line 753, in _parse_commands
    self._process_command(fields)
  File "/usr/local/lib/python3.6/site-packages/fakeredis/_server.py", line 843, in _process_command
    func, func_name = self._name_to_func(fields[0])
  File "/usr/local/lib/python3.6/site-packages/fakeredis/_server.py", line 822, in _name_to_func
    name = six.ensure_str(name, encoding='utf-8', errors='replace')
AttributeError: module 'six' has no attribute 'ensure_str'
^C[2022-04-07 09:21:22 idle.py:77 I] Stop signal received (SIGINT). Exiting...
[2022-04-07 09:21:23 dispatcher.py:149 I] Stopped 100 HandlerTasks
[2022-04-07 09:21:23 session.py:269 I] PingTask stopped
[2022-04-07 09:21:23 connection.py:77 I] Disconnected
[2022-04-07 09:21:23 session.py:288 I] NetworkTask stopped
[2022-04-07 09:21:23 session.py:174 I] Session stopped

Docker-compose youtube subscription not working

I installed bot using docker-compose, mysql, redis.

Subscribe to youtube and ping does not work.
Tell me, please, what could be the problem?

Thank you!

Errors when adding a subscription:

ytdl_1 | [2022-04-14 17:42:32 limit.py:162 I] Latest video rk3OitqWCog from Alexandr Plushev ytdl_1 | [2022-04-14 17:42:32 dispatcher.py:235 E] (1136, "Column count doesn't match value count at row 1") ytdl_1 | Traceback (most recent call last): ytdl_1 | File "/usr/local/lib/python3.9/site-packages/pyrogram/dispatcher.py", line 224, in handler_worker ytdl_1 | await self.loop.run_in_executor( ytdl_1 | File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 58, in run ytdl_1 | result = self.fn(*self.args, **self.kwargs) ytdl_1 | File "/ytdlbot/ytdlbot/ytdl_bot.py", line 111, in subscribe_handler ytdl_1 | result = vip.subscribe_channel(chat_id, link) ytdl_1 | File "/ytdlbot/ytdlbot/limit.py", line 95, in subscribe_channel ytdl_1 | self.cur.execute("INSERT INTO subscribe values(%s,%s)", (user_id, channel_id)) ytdl_1 | File "/usr/local/lib/python3.9/site-packages/pymysql/cursors.py", line 148, in execute ytdl_1 | result = self._query(query) ytdl_1 | File "/usr/local/lib/python3.9/site-packages/pymysql/cursors.py", line 310, in _query ytdl_1 | conn.query(q) ytdl_1 | File "/usr/local/lib/python3.9/site-packages/pymysql/connections.py", line 548, in query ytdl_1 | self._affected_rows = self._read_query_result(unbuffered=unbuffered) ytdl_1 | File "/usr/local/lib/python3.9/site-packages/pymysql/connections.py", line 775, in _read_query_result ytdl_1 | result.read() ytdl_1 | File "/usr/local/lib/python3.9/site-packages/pymysql/connections.py", line 1156, in read ytdl_1 | first_packet = self.connection._read_packet() ytdl_1 | File "/usr/local/lib/python3.9/site-packages/pymysql/connections.py", line 725, in _read_packet ytdl_1 | packet.raise_for_error() ytdl_1 | File "/usr/local/lib/python3.9/site-packages/pymysql/protocol.py", line 221, in raise_for_error ytdl_1 | err.raise_mysql_exception(self._data) ytdl_1 | File "/usr/local/lib/python3.9/site-packages/pymysql/err.py", line 143, in raise_mysql_exception ytdl_1 | raise errorclass(errno, errval) ytdl_1 | pymysql.err.OperationalError: (1136, "Column count doesn't match value count at row 1")

Error when "ping":

ytdl_1 | [2022-04-14 17:48:36 dispatcher.py:235 E] Telegram says: [400 MESSAGE_TOO_LONG] - The message text is over 4096 characters (caused by "messages.SendMessage") ytdl_1 | Traceback (most recent call last): ytdl_1 | File "/usr/local/lib/python3.9/site-packages/pyrogram/dispatcher.py", line 224, in handler_worker ytdl_1 | await self.loop.run_in_executor( ytdl_1 | File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 58, in run ytdl_1 | result = self.fn(*self.args, **self.kwargs) ytdl_1 | File "/ytdlbot/ytdlbot/ytdl_bot.py", line 167, in ping_handler ytdl_1 | client.send_message(chat_id, f"{bot_info}") ytdl_1 | File "/usr/local/lib/python3.9/site-packages/pyrogram/sync.py", line 78, in async_to_sync_wrap ytdl_1 | return asyncio.run_coroutine_threadsafe(coroutine, main_loop).result() ytdl_1 | File "/usr/local/lib/python3.9/concurrent/futures/_base.py", line 446, in result ytdl_1 | return self.__get_result() ytdl_1 | File "/usr/local/lib/python3.9/concurrent/futures/_base.py", line 391, in __get_result ytdl_1 | raise self._exception ytdl_1 | File "/usr/local/lib/python3.9/site-packages/pyrogram/methods/messages/send_message.py", line 128, in send_message ytdl_1 | r = await self.send( ytdl_1 | File "/usr/local/lib/python3.9/site-packages/pyrogram/methods/advanced/send.py", line 77, in send ytdl_1 | r = await self.session.send( ytdl_1 | File "/usr/local/lib/python3.9/site-packages/pyrogram/session/session.py", line 362, in send ytdl_1 | return await self._send(data, timeout=timeout) ytdl_1 | File "/usr/local/lib/python3.9/site-packages/pyrogram/session/session.py", line 332, in _send ytdl_1 | RPCError.raise_it(result, type(data)) ytdl_1 | File "/usr/local/lib/python3.9/site-packages/pyrogram/errors/rpc_error.py", line 91, in raise_it ytdl_1 | raise getattr( ytdl_1 | pyrogram.errors.exceptions.bad_request_400.MessageTooLong: Telegram says: [400 MESSAGE_TOO_LONG] - The message text is over 4096 characters (caused by "messages.SendMessage")

Bot Not working

FileNotFoundError: [Errno 2] No such file or directory: '/var/log/ytdl.log'
2022-01-18T07:27:42.692909+00:00 app[worker.1]: Job "auto_restart (trigger: interval[0:00:05], next run at: 2022-01-18 15:27:47 CST)" raised an exception
2022-01-18T07:27:42.692922+00:00 app[worker.1]: Traceback (most recent call last):
2022-01-18T07:27:42.692923+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/site-packages/apscheduler/executors/base.py", line 125, in run_job
2022-01-18T07:27:42.692923+00:00 app[worker.1]: retval = job.func(*job.args, **job.kwargs)
2022-01-18T07:27:42.692924+00:00 app[worker.1]: File "/app/ytdlbot/utils.py", line 213, in auto_restart
2022-01-18T07:27:42.692924+00:00 app[worker.1]: with open("/var/log/ytdl.log") as f:
2022-01-18T07:27:42.692925+00:00 app[worker.1]: FileNotFoundError: [Errno 2] No such file or directory: '/var/log/ytdl.log'
2022-01-18T07:27:47.692831+00:00 app[worker.1]: Job "auto_restart (trigger: interval[0:00:05], next run at: 2022-01-18 15:27:52 CST)" raised an exception
2022-01-18T07:27:47.692841+00:00 app[worker.1]: Traceback (most recent call last):
2022-01-18T07:27:47.692841+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/site-packages/apscheduler/executors/base.py", line 125, in run_job
2022-01-18T07:27:47.692841+00:00 app[worker.1]: retval = job.func(*job.args, **job.kwargs)
2022-01-18T07:27:47.692842+00:00 app[worker.1]: File "/app/ytdlbot/utils.py", line 213, in auto_restart
2022-01-18T07:27:47.692842+00:00 app[worker.1]: with open("/var/log/ytdl.log") as f:
2022-01-18T07:27:47.692843+00:00 app[worker.1]: FileNotFoundError: [Errno 2] No such file or directory: '/var/log/ytdl.log'
2022-01-18T07:27:52.692770+00:00 app[worker.1]: Job "auto_restart (trigger: interval[0:00:05], next run at: 2022-01-18 15:27:57 CST)" raised an exception
2022-01-18T07:27:52.692781+00:00 app[worker.1]: Traceback (most recent call last):
2022-01-18T07:27:52.692781+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/site-packages/apscheduler/executors/base.py", line 125, in run_job
2022-01-18T07:27:52.692782+00:00 app[worker.1]: retval = job.func(*job.args, **job.kwargs)
2022-01-18T07:27:52.692782+00:00 app[worker.1]: File "/app/ytdlbot/utils.py", line 213, in auto_restart
2022-01-18T07:27:52.692782+00:00 app[worker.1]: with open("/var/log/ytdl.log") as f:
2022-01-18T07:27:52.692783+00:00 app[worker.1]: FileNotFoundError: [Errno 2] No such file or directory: '/var/log/ytdl.log'

/ping does not work

I don't know if it's an owner-only feature, but ping command systematically fails :

Runtime information is not available outside of docker container. Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/tgbot_ping/__init__.py", line 19, in get_runtime info, raw_data = __get_container_info(container_name, display_name) File "/usr/local/lib/python3.9/site-packages/tgbot_ping/__init__.py", line 62, in __get_container_info cpu = __calculate_cpu_percent(stats) File "/usr/local/lib/python3.9/site-packages/tgbot_ping/__init__.py", line 78, in __calculate_cpu_percent system_delta = float(d["cpu_stats"]["system_cpu_usage"]) - \ KeyError: 'system_cpu_usage'

Progressbar not accurate

We does actually have a little problem (not very important, but still)
The progress bar isn't accurate, as shown under :

38% looks like 50%
82% looks like 95%

Why ?
Because of the definition of that progress bar (maybe you need to make changes here)

The fact is that the completed string (█) takes way more space than the remaining string ( )

How to fix it ?
◽By changing those strings to something that takes the same place
Examples : ⬢⬡ / ▰▱
◽ By putting the progressbar in monospace (not sure it works)

Tiktok issue

Hi, so tiktok is downloading video with tiktok watermark, is there any solution to fix it ?

Bugs what i have discovered so far

  • #59

  • Seems the codec for 4k video (which is default high quality) even struggless on flagship phone. Oneplus 7Pro

Idea to reslove:

  • Find other way to resolve the issue or V

    • Change way to pick resolution in /settings from High/Mid/Low to > (highest avalible) / 1080 / 720 / 480 / 360 to make user more control on resolution he is searching
  • Bot seems treating all youtube shorts as one, steps to reproduce

    1. Send bot youtube short with /shorts/ in url
    2. let bot send downloaded short
    3. send other short from youtube, and if bug was reproduced successfully, bot should resend old short from step II.
  • The convert to audio Inline button do not appear on videos forwarded from ARCHIVE channel
    Idea to reslove:

  • I dont know if its possible to add inline button to arleady existing and forwarded message, but if not add workaround to it by adding clickable LINK(command) inside the message for example


Video Name.mp4

https://youtu.be/examplevideo

Info: 854x480 4.9MiB 125s

Downloaded by Unknown

Click to convert: clickme


Video Resolution Problem

I think the bot sends you the video in compressed form which lowers the video quality, can you provide an option so that the bot send the video uncompressed with the video's highest resolution. Telegram has that default compressing option which compresses the video to go fast but the thing I want is that there should be a option to choose where I want compressed or uncompressed video. Hopefully this will be added!

I get this error in heroku log

File "/app/ytdlbot/ytdl_bot.py", line 236, in
2022-01-12T08:57:58.803374+00:00 app[worker.1]: Version: {get_revision()}
2022-01-12T08:57:58.803376+00:00 app[worker.1]: File "/app/ytdlbot/utils.py", line 107, in get_revision
2022-01-12T08:57:58.803458+00:00 app[worker.1]: revision = subprocess.check_output("git -C ../ rev-parse --short HEAD".split()).decode("u8").replace("\n", "")
2022-01-12T08:57:58.803466+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/subprocess.py", line 424, in check_output
2022-01-12T08:57:58.803618+00:00 app[worker.1]: return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
2022-01-12T08:57:58.803618+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/subprocess.py", line 528, in run
2022-01-12T08:57:58.803775+00:00 app[worker.1]: raise CalledProcessError(retcode, process.args,
2022-01-12T08:57:58.803840+00:00 app[worker.1]: subprocess.CalledProcessError: Command '['git', '-C', '../', 'rev-parse', '--short', 'HEAD']' returned non-zero exit status 128.
2022-01-12T08:57:59.273816+00:00 heroku[worker.1]: State changed from up to crashed
2022-01-12T08:57:59.196568+00:00 heroku[worker.1]: Process exited with status 1

docker image builder fails at "build and push step"

/usr/bin/docker buildx build --cache-from type=local,src=/tmp/.buildx-cache --cache-to type=local,dest=/tmp/.buildx-cache-new,mode=max --iidfile /tmp/docker-build-push-GfE4m1/iidfile --platform linux/arm,linux/amd64,linux/arm64 --tag ***/ --tag ghcr.io/ --metadata-file /tmp/docker-build-push-GfE4m1/metadata-file --push .  
error: invalid tag "***/": invalid reference format  
Error: buildx failed with: error: invalid tag "***/": invalid reference format

Flower problem docker-compose

Hello im trying to setup bot using dockercompose, as i read README i dont want vip system then i commented out mysql and redis from the compose file:
as shown below

version: '3.1'

services:
  socat:
    image: jmb12686/socat
    restart: always
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    entrypoint: [ "socat", "tcp-listen:2375,fork,reuseaddr","unix-connect:/var/run/docker.sock" ]

  #redis:
    #image: redis:alpine
    #restart: always
    #logging:
    #  driver: none
    #ports:
    #  - "6379:6379"

  #mysql:
    #image: mariadb
    #restart: always
    #volumes:
    #  - ./db_data:/var/lib/mysql
    #environment:
    #  MYSQL_ROOT_PASSWORD: 'root'
    #logging:
    #  driver: none
    #ports:
    #  - "3306:3306"

  ytdl:
    image: bennythink/ytdlbot
    env_file:
      - env/ytdl.env
    restart: always
    depends_on:
      - socat
    volumes:
      - ./data/instagram.com_cookies.txt:/ytdlbot/ytdlbot/instagram.com_cookies.txt
      - ./data/vnstat/:/var/lib/vnstat/

  flower:
    image: bennythink/ytdlbot
    env_file:
      - env/ytdl.env
    restart: on-failure
    command: [ "/usr/local/bin/celery",
               "-A", "flower_tasks", "flower",
               "--basic_auth=benny:123456",
               "--address=0.0.0.0", "--persistent","--purge_offline_workers=3600" ]
    volumes:
      - ./data/flower:/ytdlbot/ytdlbot/flower
    ports:
      - "5555:5555"

next i made env file

TOKEN=515*************Ibc
APP_ID=1*****2
APP_HASH=a38**********3713c
OWNER=Bartixxx

thats my config, i also tried step 3.2.2
i have go to ./data/ whih is /home/pi/ytbot/data
i did

import dbm;dbm.open("flower","n");exit()

in python console, flower.db file was created

but still i have errors

Some pics:

image
image
image

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.