Skip to content

Commit

Permalink
chore: Update youtubed CLI command in pyproject.toml and fix audio ex…
Browse files Browse the repository at this point in the history
…traction bug
  • Loading branch information
mauriciobellon committed Jul 11, 2024
1 parent fcf412f commit 02fa785
Show file tree
Hide file tree
Showing 14 changed files with 94 additions and 22 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Python application

on: [push, pull_request]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
poetry install
- name: Run tests
run: |
poetry run pytest
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
data/
__pycache__/
cookies.txt
18 changes: 18 additions & 0 deletions contributing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#### CONTRIBUTING.md
```markdown
# Contributing to YouTubed

We welcome contributions to YouTubed! Here are a few guidelines to follow:

## How to Contribute

1. Fork the repository.
2. Create a new branch (`git checkout -b feature/your-feature-name`).
3. Make your changes.
4. Commit your changes (`git commit -m 'Add some feature'`).
5. Push to the branch (`git push origin feature/your-feature-name`).
6. Create a new Pull Request.

## Code of Conduct

Please note that this project is released with a [Contributor Code of Conduct](CODE_OF_CONDUCT.md). By participating in this project you agree to abide by its terms.
21 changes: 21 additions & 0 deletions license.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Mauricio Bellon

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.
10 changes: 7 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,15 @@ yt-dlp = "^2024.7.9"
pydub = "^0.25.1"
youtube-transcript-api = "^0.6.2"


[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"


[tool.poetry.scripts]
youtubed = "youtubed.main:youtubed"
youtubed = "youtubed.main:youtubed"

[tool.black]
line-length = 88

[tool.flake8]
max-line-length = 88
29 changes: 14 additions & 15 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,27 @@
# YouTubed
A simple youtube downloader

A simple YouTube downloader.

## Installation


You need to have:
- [Git](https://git-scm.com/downloads)
- [Python](https://www.python.org/downloads/)
- [Poetry](https://python-poetry.org/docs/#installation)



```bash
git clone https://github.com/mauriciobellon/youtubed.git
cd youtubed
poetry install
poetry run youtubed --help
```
Steps:
1. Clone the repository:
```bash
git clone https://github.com/mauriciobellon/youtubed.git
cd youtubed
```
2. Install dependencies using Poetry:
```bash
poetry install
```

## Usage
```bash
youtubed --help
```

## License
MIT
To use the YouTube downloader, run:
```bash
youtubed --help
2 changes: 2 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[flake8]
max-line-length = 88
13 changes: 9 additions & 4 deletions youtubed/main.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
import os
import click
from help_box import help_box

output_base_path = 'data/donwloads'

@click.command()
@click.argument('url')
def youtubed(url):

output_base_path = 'data'

if not os.path.exists(output_base_path):
os.makedirs(output_base_path)

if url.startswith('https://www.youtube.com/playlist'):
from .process_playlist import process_playlist
from .utils.process_playlist import process_playlist
process_playlist(url, output_base_path)

elif url.startswith('https://www.youtube.com/watch'):
from .process_video import process_video
from .utils.process_video import process_video
process_video(url, output_base_path)

else:
Expand All @@ -21,4 +25,5 @@ def youtubed(url):


if __name__ == '__main__':
from utils.help_box import help_box
help_box()
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 02fa785

Please sign in to comment.