mirror of
https://github.com/tropicoo/yt-dlp-bot.git
synced 2024-09-20 06:46:08 +08:00
Update README
This commit is contained in:
parent
20d8d55a66
commit
79ff67b410
Before Width: | Height: | Size: 58 KiB After Width: | Height: | Size: 58 KiB |
Before Width: | Height: | Size: 294 KiB After Width: | Height: | Size: 294 KiB |
|
@ -4,7 +4,7 @@
|
|||
Dockerfile.base
|
||||
LICENSE
|
||||
README.md
|
||||
assets
|
||||
.assets
|
||||
docker-compose.yml
|
||||
pyproject.toml
|
||||
|
||||
|
|
10
README.md
10
README.md
|
@ -1,7 +1,7 @@
|
|||
## yt-dlp-bot
|
||||
Simple and reliable YouTube Download Telegram Bot.
|
||||
|
||||
![frames](assets/download_success.png)
|
||||
![frames](.assets/download_success.png)
|
||||
|
||||
## 😂 Features
|
||||
* Download videos from any [yt-dlp](https://github.com/yt-dlp/yt-dlp) supported website
|
||||
|
@ -51,11 +51,17 @@ After pasting video URL(s) bot will send you appropriate message whether they we
|
|||
1. If you want to change `yt-dlp` download options, go to the `worker/ytdl_opts`
|
||||
directory, copy content from `default.py` to `user.py` and modify as you wish
|
||||
by checking [available options](https://github.com/yt-dlp/yt-dlp/blob/master/yt_dlp/YoutubeDL.py#L180).
|
||||
2. Default max simultaneous video downloads by worker service is 2. Change the `MAX_SIMULTANEOUS_DOWNLOADS`
|
||||
variable in `envs/.env_worker` to desired value but keep in mind `yt-dlp` may glitch when the value is high.
|
||||
3. Worker service (particularly the FFmpeg process) makes a JPEG thumbnail from the video. It's needed when
|
||||
you choose to upload the video to the Telegram chat. By default, it tries to make it on the 10th second
|
||||
of the video, but if the video is shorter, it will make it on `video length / 2` time point because the FFmpeg
|
||||
process will error out. Change the `THUMBNAIL_FRAME_SECOND` variable if needed in the `envs/.env_worker` file.
|
||||
|
||||
## 🛑 Failed download
|
||||
If your URL can't be downloaded for some reason, you will see this
|
||||
|
||||
![frames](assets/download_failed.png)
|
||||
![frames](.assets/download_failed.png)
|
||||
|
||||
## Access
|
||||
- **API**: default port `1984` and no auth. Port can be changed in `docker-compose.yml`
|
||||
|
|
|
@ -10,14 +10,14 @@ from core.workers.manager import RabbitWorkerManager
|
|||
from yt_shared.rabbit import get_rabbitmq
|
||||
from yt_shared.utils.tasks.tasks import create_task
|
||||
|
||||
REGEX_NOT_START_WITH_SLASH = r'^[^/]'
|
||||
|
||||
|
||||
class BotLauncher:
|
||||
"""Bot launcher which parses configuration file, creates bot with
|
||||
camera instances and finally starts the bot.
|
||||
"""
|
||||
|
||||
REGEX_NOT_START_WITH_SLASH = r'^[^/]'
|
||||
|
||||
def __init__(self) -> None:
|
||||
"""Constructor."""
|
||||
self._log = logging.getLogger(self.__class__.__name__)
|
||||
|
@ -45,7 +45,7 @@ class BotLauncher:
|
|||
cb.on_message,
|
||||
filters=filters.user(list(self._bot.allowed_users.keys()))
|
||||
& filters.chat(list(self._bot.allowed_users.keys()))
|
||||
& filters.regex(REGEX_NOT_START_WITH_SLASH),
|
||||
& filters.regex(self.REGEX_NOT_START_WITH_SLASH),
|
||||
),
|
||||
)
|
||||
|
||||
|
@ -55,7 +55,7 @@ class BotLauncher:
|
|||
self._rabbit_mq.register(),
|
||||
task_name=task_name,
|
||||
logger=self._log,
|
||||
exception_message='Task %s raised an exception',
|
||||
exception_message='Task "%s" raised an exception',
|
||||
exception_message_args=(task_name,),
|
||||
)
|
||||
|
||||
|
@ -67,7 +67,7 @@ class BotLauncher:
|
|||
YtdlpNewVersionNotifyTask(bot=self._bot).run(),
|
||||
task_name=task_name,
|
||||
logger=self._log,
|
||||
exception_message='Task %s raised an exception',
|
||||
exception_message='Task "%s" raised an exception',
|
||||
exception_message_args=(task_name,),
|
||||
)
|
||||
|
||||
|
@ -75,7 +75,7 @@ class BotLauncher:
|
|||
"""Start telegram bot and related processes."""
|
||||
await self._bot.start()
|
||||
|
||||
self._log.info('Starting %s bot', (await self._bot.get_me()).first_name)
|
||||
self._log.info('Starting "%s" bot', (await self._bot.get_me()).first_name)
|
||||
await self._bot.send_startup_message()
|
||||
await self._start_tasks()
|
||||
await self._bot.run_forever()
|
||||
|
|
|
@ -43,7 +43,7 @@ class UserSchema(BaseUserSchema):
|
|||
return False
|
||||
|
||||
|
||||
def change_type(values: list[int]) -> list[BaseUserSchema]:
|
||||
def _change_type(values: list[int]) -> list[BaseUserSchema]:
|
||||
return [BaseUserSchema(id=id_) for id_ in values]
|
||||
|
||||
|
||||
|
@ -54,7 +54,7 @@ class ApiSchema(RealBaseModel):
|
|||
silent: StrictBool
|
||||
video_caption: VideoCaptionSchema
|
||||
|
||||
_transform_chat_ids = validator('upload_to_chat_ids', pre=True)(change_type)
|
||||
_transform_chat_ids = validator('upload_to_chat_ids', pre=True)(_change_type)
|
||||
|
||||
|
||||
class TelegramSchema(RealBaseModel):
|
||||
|
|
|
@ -50,7 +50,7 @@ class SuccessHandler(AbstractHandler):
|
|||
).run(),
|
||||
task_name=task_name,
|
||||
logger=self._log,
|
||||
exception_message='Task %s raised an exception',
|
||||
exception_message='Task "%s" raised an exception',
|
||||
exception_message_args=(task_name,),
|
||||
)
|
||||
|
||||
|
|
|
@ -154,7 +154,7 @@ class UploadTask(AbstractTask):
|
|||
self._save_cache_to_db(video),
|
||||
task_name=db_cache_task_name,
|
||||
logger=self._log,
|
||||
exception_message='Task %s raised an exception',
|
||||
exception_message='Task "%s" raised an exception',
|
||||
exception_message_args=(db_cache_task_name,),
|
||||
)
|
||||
|
||||
|
|
|
@ -20,6 +20,6 @@ class SuccessResultWorker(AbstractResultWorker):
|
|||
self.HANDLER_CLS(body=body, bot=self._bot).handle(),
|
||||
task_name=task_name,
|
||||
logger=self._log,
|
||||
exception_message='Task %s raised an exception',
|
||||
exception_message='Task "%s" raised an exception',
|
||||
exception_message_args=(task_name,),
|
||||
)
|
||||
|
|
|
@ -18,5 +18,5 @@ RABBITMQ_PORT=5672
|
|||
|
||||
REDIS_HOST=yt_redis
|
||||
|
||||
LOG_LEVEL=DEBUG
|
||||
LOG_LEVEL=INFO
|
||||
TMP_DOWNLOAD_PATH=/tmp/download_tmpfs
|
||||
|
|
|
@ -102,7 +102,7 @@ class VideoService:
|
|||
self._copy_file_to_storage(video),
|
||||
task_name=task_name,
|
||||
logger=self._log,
|
||||
exception_message='Task %s raised an exception',
|
||||
exception_message='Task "%s" raised an exception',
|
||||
exception_message_args=(task_name,),
|
||||
)
|
||||
|
||||
|
@ -113,7 +113,7 @@ class VideoService:
|
|||
MakeThumbnailTask(thumb_path, file_path, duration=duration).run(),
|
||||
task_name=MakeThumbnailTask.__class__.__name__,
|
||||
logger=self._log,
|
||||
exception_message='Task %s raised an exception',
|
||||
exception_message='Task "%s" raised an exception',
|
||||
exception_message_args=(MakeThumbnailTask.__class__.__name__,),
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in a new issue