Skip to content
This repository has been archived by the owner on Jul 18, 2023. It is now read-only.

Commit

Permalink
release v1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
rin-gil committed Nov 30, 2022
1 parent 2364b78 commit c721fa7
Show file tree
Hide file tree
Showing 34 changed files with 598 additions and 154 deletions.
9 changes: 1 addition & 8 deletions .env.dist
Original file line number Diff line number Diff line change
@@ -1,9 +1,2 @@
# Paste the bot token here and rename the file to .env
BOT_TOKEN=123456:Your-TokEn_ExaMple
ADMINS=123456,654321
USE_REDIS=False

DB_USER=exampleDBUserName
PG_PASSWORD=examplePostgresPass
DB_PASS=exampleDBPassword
DB_NAME=exampleDBName
DB_HOST=127.0.0.1
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,3 @@ venv/

# Temp
temp/

# Database
*.sqlite3
21 changes: 21 additions & 0 deletions LICENCE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2022 Ringil

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
64 changes: 55 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,68 @@
## Bot template for 2.12 <= aiogram <3.0
<p align="center">
<img src="https://repository-images.githubusercontent.com/571268828/71f20754-3fcd-4833-b968-61b113ab6930" alt="YouTube Shorts Download Bot" width="640">
</p>

<p align="center">
<a href="https://www.python.org/downloads/release/python-3100/">
<img src="https://img.shields.io/badge/python-v3.10-informational" alt="python version">
<a href="https://www.python.org/downloads/release/python-3110/">
<img src="https://img.shields.io/badge/python-v3.11-informational" alt="python version">
</a>
<a href="https://pypi.org/project/aiogram/2.12/">
<img src="https://img.shields.io/badge/aiogram-v2.12-informational" alt="aiogram version">
<a href="https://pypi.org/project/aiogram/2.23.1/">
<img src="https://img.shields.io/badge/aiogram-v2.23.1-informational" alt="aiogram version">
</a>
<a href="https://pypi.org/project/environs/9.5.0/">
<img src="https://img.shields.io/badge/environs-v9.5.0-informational" alt="environs version">
</a>
<a href="https://pypi.org/project/pytube/12.1.0/">
<img src="https://img.shields.io/badge/pytube-v12.1.0-informational" alt="pytube version">
</a>
<a href="https://github.com/psf/black">
<img alt="Code style: black" src="https://img.shields.io/badge/code%20style-black-black.svg">
</a>
<a href="https://github.com/rin-gil/aiogram_template/actions/workflows/tests.yml">
<img src="https://github.com/rin-gil/aiogram_template/actions/workflows/tests.yml/badge.svg" alt="Code tests">
<a href="https://github.com/rin-gil/YouTubeShortsDownloader/actions/workflows/tests.yml">
<img src="https://github.com/rin-gil/YouTubeShortsDownloader/actions/workflows/tests.yml/badge.svg" alt="Code tests">
</a>
<a href="https://github.com/rin-gil/aiogram_template/actions/workflows/codeql.yml">
<img src="https://github.com/rin-gil/aiogram_template/actions/workflows/codeql.yml/badge.svg" alt="Code tests">
<a href="https://github.com/rin-gil/YouTubeShortsDownloader/actions/workflows/codeql.yml">
<img src="https://github.com/rin-gil/YouTubeShortsDownloader/actions/workflows/codeql.yml/badge.svg" alt="Code tests">
</a>
<a href="https://github.com/rin-gil/YouTubeShortsDownloader/blob/master/LICENCE">
<img src="https://img.shields.io/badge/licence-MIT-success" alt="MIT licence">
</a>
</p>

<p align="right">
<a href="https://github.com/rin-gil/YouTubeShortsDownloader/blob/master/README.ru.md">
<img src="https://raw.githubusercontent.com/rin-gil/rin-gil/main/assets/img/icons/flags/russia_24x24.png" alt="Ru">
</a>
<a href="https://github.com/rin-gil/YouTubeShortsDownloader/blob/master/README.ua.md">
<img src="https://raw.githubusercontent.com/rin-gil/rin-gil/main/assets/img/icons/flags/ukraine_24x24.png" alt="Ua">
</a>
</p>

## YouTube Shorts Download Bot

Bot to download videos from YouTube Shorts. Working version is available here [https://t.me/YouTubeShortsDownloaderBot](https://t.me/YouTubeShortsDownloaderBot)

### Installing

```
git clone https://github.com/rin-gil/YouTubeShortsDownloader.git
cd YouTubeShortsDownloader
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
mv .env.dist .env
```

### Setup and launch

* Register a new bot with [BotFather](https://t.me/BotFather) and copy the obtained token
* Insert the bot token into the .env file
* Running the bot through the bot.py file `python bot.py`

### Developers

* [Ringil](https://github.com/rin-gil)

### License

YouTubeShortsDownloader is licensed under [MIT](https://github.com/rin-gil/YouTubeShortsDownloader/blob/master/LICENCE)
68 changes: 68 additions & 0 deletions README.ru.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<p align="center">
<img src="https://repository-images.githubusercontent.com/571268828/71f20754-3fcd-4833-b968-61b113ab6930" alt="YouTube Shorts Download Bot" width="640">
</p>

<p align="center">
<a href="https://www.python.org/downloads/release/python-3110/">
<img src="https://img.shields.io/badge/python-v3.11-informational" alt="python version">
</a>
<a href="https://pypi.org/project/aiogram/2.23.1/">
<img src="https://img.shields.io/badge/aiogram-v2.23.1-informational" alt="aiogram version">
</a>
<a href="https://pypi.org/project/environs/9.5.0/">
<img src="https://img.shields.io/badge/environs-v9.5.0-informational" alt="environs version">
</a>
<a href="https://pypi.org/project/pytube/12.1.0/">
<img src="https://img.shields.io/badge/pytube-v12.1.0-informational" alt="pytube version">
</a>
<a href="https://github.com/psf/black">
<img alt="Code style: black" src="https://img.shields.io/badge/code%20style-black-black.svg">
</a>
<a href="https://github.com/rin-gil/YouTubeShortsDownloader/actions/workflows/tests.yml">
<img src="https://github.com/rin-gil/YouTubeShortsDownloader/actions/workflows/tests.yml/badge.svg" alt="Code tests">
</a>
<a href="https://github.com/rin-gil/YouTubeShortsDownloader/actions/workflows/codeql.yml">
<img src="https://github.com/rin-gil/YouTubeShortsDownloader/actions/workflows/codeql.yml/badge.svg" alt="Code tests">
</a>
<a href="https://github.com/rin-gil/YouTubeShortsDownloader/blob/master/LICENCE">
<img src="https://img.shields.io/badge/licence-MIT-success" alt="MIT licence">
</a>
</p>

<p align="right">
<a href="https://github.com/rin-gil/YouTubeShortsDownloader/blob/master/README.md">
<img src="https://raw.githubusercontent.com/rin-gil/rin-gil/main/assets/img/icons/flags/united-kingdom_24x24.png" alt="En">
</a>
<a href="https://github.com/rin-gil/YouTubeShortsDownloader/blob/master/README.ua.md">
<img src="https://raw.githubusercontent.com/rin-gil/rin-gil/main/assets/img/icons/flags/ukraine_24x24.png" alt="Ua">
</a>
</p>

## YouTube Shorts Download Bot

Бот для загрузки видео с YouTube Shorts. Рабочая версия доступна по ссылке [https://t.me/YouTubeShortsDownloaderBot](https://t.me/YouTubeShortsDownloaderBot)

### Установка

```
git clone https://github.com/rin-gil/YouTubeShortsDownloader.git
cd YouTubeShortsDownloader
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
mv .env.dist .env
```

### Настройка и запуск

* Зарегистрируйте нового бота у [BotFather](https://t.me/BotFather) и скопируйте полученный токен
* Вставьте токен бота в файл .env
* Запуск бота через файл bot.py `python bot.py`

### Разработчики

* [Ringil](https://github.com/rin-gil)

### Лицензия

Проект YouTubeShortsDownloader распространяется по лицензии [MIT](https://github.com/rin-gil/YouTubeShortsDownloader/blob/master/LICENCE)
68 changes: 68 additions & 0 deletions README.ua.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<p align="center">
<img src="https://repository-images.githubusercontent.com/571268828/71f20754-3fcd-4833-b968-61b113ab6930" alt="YouTube Shorts Download Bot" width="640">
</p>

<p align="center">
<a href="https://www.python.org/downloads/release/python-3110/">
<img src="https://img.shields.io/badge/python-v3.11-informational" alt="python version">
</a>
<a href="https://pypi.org/project/aiogram/2.23.1/">
<img src="https://img.shields.io/badge/aiogram-v2.23.1-informational" alt="aiogram version">
</a>
<a href="https://pypi.org/project/environs/9.5.0/">
<img src="https://img.shields.io/badge/environs-v9.5.0-informational" alt="environs version">
</a>
<a href="https://pypi.org/project/pytube/12.1.0/">
<img src="https://img.shields.io/badge/pytube-v12.1.0-informational" alt="pytube version">
</a>
<a href="https://github.com/psf/black">
<img alt="Code style: black" src="https://img.shields.io/badge/code%20style-black-black.svg">
</a>
<a href="https://github.com/rin-gil/YouTubeShortsDownloader/actions/workflows/tests.yml">
<img src="https://github.com/rin-gil/YouTubeShortsDownloader/actions/workflows/tests.yml/badge.svg" alt="Code tests">
</a>
<a href="https://github.com/rin-gil/YouTubeShortsDownloader/actions/workflows/codeql.yml">
<img src="https://github.com/rin-gil/YouTubeShortsDownloader/actions/workflows/codeql.yml/badge.svg" alt="Code tests">
</a>
<a href="https://github.com/rin-gil/YouTubeShortsDownloader/blob/master/LICENCE">
<img src="https://img.shields.io/badge/licence-MIT-success" alt="MIT licence">
</a>
</p>

<p align="right">
<a href="https://github.com/rin-gil/YouTubeShortsDownloader/blob/master/README.md">
<img src="https://raw.githubusercontent.com/rin-gil/rin-gil/main/assets/img/icons/flags/united-kingdom_24x24.png" alt="En">
</a>
<a href="https://github.com/rin-gil/YouTubeShortsDownloader/blob/master/README.ru.md">
<img src="https://raw.githubusercontent.com/rin-gil/rin-gil/main/assets/img/icons/flags/russia_24x24.png" alt="Ru">
</a>
</p>

## YouTube Shorts Download Bot

Бот для завантаження відео з YouTube Shorts. Робоча версія доступна за посиланням [https://t.me/YouTubeShortsDownloaderBot](https://t.me/YouTubeShortsDownloaderBot)

### Встановлення

```
git clone https://github.com/rin-gil/YouTubeShortsDownloader.git
cd YouTubeShortsDownloader
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
mv .env.dist .env
```

### Налаштування та запуск

* Зареєструйте нового бота у [BotFather](https://t.me/BotFather) і скопіюйте отриманий токен
* Вставте токен бота у файл .env
* Запуск бота через файл bot.py `python bot.py`

### Розробники

* [Ringil](https://github.com/rin-gil)

### Ліцензія

Проект YouTubeShortsDownloader поширюється за ліцензією [MIT](https://github.com/rin-gil/YouTubeShortsDownloader/blob/master/LICENCE)
29 changes: 13 additions & 16 deletions bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,30 @@
from aiogram.contrib.fsm_storage.memory import MemoryStorage

from tgbot.config import load_config, Config
from tgbot.filters.admin import AdminFilter
from tgbot.handlers.admin import register_admin
from tgbot.handlers.echo import register_echo
from tgbot.handlers.user import register_user
from tgbot.handlers.commands import register_commands_handlers
from tgbot.handlers.messages import register_messages_handlers
from tgbot.middlewares.localization import i18n
from tgbot.misc.commands import set_default_commands
from tgbot.misc.logger import log
from tgbot.misc.logger import logger


def register_all_filters(dp: Dispatcher) -> None:
"""Registers filters"""
dp.filters_factory.bind(AdminFilter)
def register_all_middlewares(dp: Dispatcher) -> None:
"""Registers middlewares"""
dp.middleware.setup(i18n)


def register_all_handlers(dp: Dispatcher) -> None:
"""Registers handlers"""
register_admin(dp)
register_user(dp)
register_echo(dp)
register_commands_handlers(dp)
register_messages_handlers(dp)


async def main() -> None:
"""Launches the bot"""
config: Config = load_config(path=".env")
bot: Bot = Bot(token=config.tg_bot.token, parse_mode="HTML")
dp: Dispatcher = Dispatcher(bot, storage=MemoryStorage())
bot["config"] = config
register_all_filters(dp)
register_all_middlewares(dp)
register_all_handlers(dp)
try: # On starting bot
await set_default_commands(dp)
Expand All @@ -46,11 +43,11 @@ async def main() -> None:


if __name__ == "__main__":
log.info("Starting bot")
logger.info("Starting bot")
try:
run(main())
except (KeyboardInterrupt, SystemExit):
pass
except Exception as ex:
log.critical("Unknown error: %s", ex)
log.info("Bot stopped!")
logger.critical("Unknown error: %s", ex)
logger.info("Bot stopped!")
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
aiogram>=2.12,<3.0
aiogram==2.23.1
environs==9.5.0
pytube==12.1.0
6 changes: 3 additions & 3 deletions systemd/tgbot.service
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Example configuration for running the bot on a server as a systemd service
[Unit]
Description=TgBot daemon
Description=YouTubeShortsDownloader daemon
After=network.target

[Service]
User=tgbot
Group=tgbot
Type=simple
WorkingDirectory=/opt/tgbot
ExecStart=/opt/tgbot/venv/bin/python /opt/tgbot/bot.py
WorkingDirectory=/opt/YouTubeShortsDownloader
ExecStart=/opt/YouTubeShortsDownloader/venv/bin/python /opt/YouTubeShortsDownloader/bot.py
Restart=always

[Install]
Expand Down
Binary file added tgbot/assets/img/bot_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit c721fa7

Please sign in to comment.