Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adiciona README para resolver conflitos de dependências em sistemas Linux #791

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions projects/YouTube Video Downloader/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# youtube_video_downloader

Este projeto utiliza `yt-dlp` para baixar vídeos do YouTube com a resolução mais alta disponível ou com a resolução escolhida pelo usuário.

## Descrição

- **Nome do Script:** `you_tube_analyzer.py`
- **Propósito:** Baixar vídeos do YouTube com alta qualidade.
- **Funcionalidades:**
- Permite ao usuário escolher entre as resoluções disponíveis.
- Seleciona automaticamente a maior resolução disponível, se preferido.

## Requisitos

- Python 3
- yt-dlp

## Uso

1. Clone o repositório para sua máquina local.
```bash
git clone https://github.com/Mrinank-Bhowmick/python-beginner-projects.git

2. Navegue até o diretório do script
```bash
cd python-beginner-projects/projects/YouTube\ Video\ Downloader/

3. Instale as dependências necessárias.
```bash
pip install yt-dlp

4. Execute you_tube_analyzer.py
```bash
python3 you_tube_analyzer.py

## Solução de Problemas

Se você encontrar conflitos de dependências com versões mais recentes, siga os passos
abaixo para configurar um ambiente virtual e instalar as versões específicas necessárias:

### 1. Crie e ative um ambiente virtual:
```bash
python3 -m venv meu_ambiente
source meu-ambiente/bin/activate
```

### 2. Instale as versões compatíveis das dependências:
```bash
pip install requests_mock clyent==1.2.1 nbformat==5.4.0 requests==2.28.1
```

9 changes: 5 additions & 4 deletions projects/YouTube Video Downloader/you_tube_analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,14 @@ def download_youtube_video(video_url):
ydl_opts["format"] = format_id
else:
# Select the highest resolution format
highest_resolution = max(formats, key=lambda x: x.get("height", 0))
highest_resolution = max(formats, key=lambda x: (x.get("height") or 0))
format_id = highest_resolution["format_id"]
ydl_opts["format"] = format_id

# Download the video
ydl.download([video_url])
print("Download complete using yt-dlp!")
# Update options with selected format
with yt_dlp.YoutubeDL(ydl_opts) as ydl:
ydl.download([video_url])
print("Downlaod complete using yt-dlp")


if __name__ == "__main__":
Expand Down
Loading