Utilizando FastAPI para interagir com a API do YouTube (teste).
- Python 3.9 ou superior
- crie e ative seu ambiente virtual:
python -m venv venv+source venv/bin/activateno diretóriobackend. - instale dependências:
pip install -r requirements.txt - crie e configure o .env com sua chave
YOUTUBE_API_KEY(consulte a documentação aqui) emapplication/core/.env - utilize o Makefile com
make runou se preferiruvicorn application.main:app --reload - execute o docker-compose, você pode acessar o pgadmin em:
http://localhost:5050/login?next=/browser/ - servidor: http://127.0.0.1:8000
- Http Method:
GET - Endpoint:
/youtube/video-info/{video_id} - Resumo: Retorna informações sobre um vÃdeo do YouTube. O
video_idé o identificador único de um vÃdeo do YouTube. - Parâmetros: video_id (path): O ID do vÃdeo do YouTube que deseja consultar.
{
"kind": "youtube#videoListResponse",
"etag": "string",
"items": [
{
"kind": "youtube#video",
"etag": "string",
"id": "string",
"snippet": {
"publishedAt": "datetime",
"channelId": "string",
"title": "string",
"description": "string",
"thumbnails": {
"default": {
"url": "string",
"width": 120,
"height": 90
},
"medium": {
"url": "string",
"width": 320,
"height": 180
},
"high": {
"url": "string",
"width": 480,
"height": 360
},
"standard": {
"url": "string",
"width": 640,
"height": 480
}
},
"channelTitle": "string",
"tags": ["string"],
"categoryId": "string",
"liveBroadcastContent": "string",
"localized": {
"title": "string",
"description": "string"
}
}
}
],
"pageInfo": {
"totalResults": 1,
"resultsPerPage": 1
}
}- Erro:
500