Шейко Михаил Андреевич Б05-352
This is a convenient web tool for creating and controlling youtube playlists with donation alerts integration
- Integrated video player
- Ability to add videos manually
- Ability to control video flow
- Ability to skip to the desired video in queue
Integration with donationalerts linked media
Integration with dontaionalerts api was discarded because of extremely poor written API docs.
@dataclass
class Video:
"""
Dataclass which holds information about video
Attributes:
- id: str - Video object uuid
- title: str | None - Video title
- thumbnail_url: str | None - Video thumbnail url
- video_url: str - YouTube video url
- playback_url: str - Video playback url
"""
id: str | None
title: str | None
thumbnail_url: str | None
video_url: str | None
playback_url: str | None
EDIT: Deleted Playlist class as it's not needed
When addition of the video is requested either by hand or via API exemplar of class Video is created. All of its fields are assigned asynchronously. This guarantees that simultaneous requests can be worked with correctly. Then it's being put into the queue.
When deletion request arrives if video is in the queue it's being deleted. If it's not present, then request is ignored.
If API is given wrong link video it responds with ERROR 400 (Bad Request). No changes to system state are made in this case.
UI elemnts use same API as an external user does.
[GET] /api/v1/get_next
Get next video from list[GET] /api/v1/get_current
Get currently playing video[PUT] /api/v1/add?video_url=<video_url>
Add video to the queue by its url[DELTE] /api/v1/delete?video_id=<video_id>
Delete video by its id[GET] /api/v1/get_video_list
Get list of links and titles to videos in queue[GET] /api/v1/get_video_data_by_id?video_id=<video_id>
Get video data, including playback url, by its id- python >= 3.12
- flask
- flask[async]
- turbo-flask
- flask-pydantic
- pydantic
- aiohttp
- yt-dlp
- python-dotenv
- Install dependencies either via pip or poetry:
- In case of pip you need to run
pip install -r requirements.txt
- In case of poetry you need to run
poetry install
- In case of pip you need to run
- Create
.env
file in the root of the project with the following content:YOUTUBE_API_KEY=<your_youtube_api_key> COOKIE_FILE_PATH=<path_to_cookie_file_with_youtube_auth>
- Cookie file can be obtained by following yt-dlp documentation
- Run the server by executing
python main.py