This bot fetches videos from YouTube for the top three best tracks of all time by a specified artist according to Last.fm charts.
You can try it in Telegram: @toptracksbot
Just send an artist or a band name to the bot to get their top three tracks.
/info artist_name
or/i artist_name
- get a short bio of an artist/help
or/h
- show help message
toptracksbot.mp4
You can deploy this bot yourself using Docker and Docker Compose.
-
Install Docker and Docker Compose
-
Clone this repository
-
Create
.env
file at the root of the cloned repo with the following variables declared there:Required:
TTBOT_TOKEN
- Auth token of your Telegram bot (how to get)TTBOT_LASTFM_API_KEY
- Key for Last.fm API (how to get)TTBOT_YOUTUBE_API_KEY
- Key for YouTube API (how to get)
Optional:
TTBOT_DATABASE_USER
- Set a username for the database (defaulttoptracks
)TTBOT_DATABASE_PASS
- Set a password for the database (defaulttoptracks
)TTBOT_DATABASE_PORT
- Set a port for the database (default5432
)TTBOT_VALID_FOR_DAYS
- Number of days for which information about the artist's top three tracks is cached in the database (default30
)
Check an example of
.env
file. -
Run tests using command
docker compose run --rm tests; docker compose --profile test down --rmi all
(this will run tests in a container and remove test containers and images afterward) -
Start the bot using command
docker compose up -d
(this will build images for the bot, database and start containers with them)
- python-telegram-bot - This library provides a pure Python interface for the Telegram Bot API.
- HTTPX - Fully featured HTTP client for Python 3, which provides sync and async APIs, and support for both HTTP/1.1 and HTTP/2.
- asyncpg - A fast PostgreSQL Database Client Library for Python/asyncio.
- Beautiful Soup 4 - Beautiful Soup is a library that makes it easy to scrape information from web pages.
This project is licensed under the MIT License - see the LICENSE file for details.