Skip to content

Commit

Permalink
Moved Downloader to turbodl PyPI project
Browse files Browse the repository at this point in the history
  • Loading branch information
henrique-coder committed Dec 19, 2024
1 parent b7165ed commit 9752cb1
Show file tree
Hide file tree
Showing 11 changed files with 41 additions and 422 deletions.
1 change: 0 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ concurrency:
jobs:
test:
name: 🐍 Python ${{ matrix.python-version }} on ${{ matrix.os }}
if: startsWith(github.event.head_commit.message, 'Bump version to') || startsWith(github.event.head_commit.message, '[CI]')
strategy:
fail-fast: false
matrix:
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ jobs:
### Available Extras:
- 🎬 YouTube Tools: `streamsnapper[youtube]`
- 📥 Downloader: `streamsnapper[downloader]`
- 🔄 Merger: `streamsnapper[merger]`
- ✨ All Features: `streamsnapper[all]`
Expand All @@ -63,7 +62,7 @@ jobs:
### 📊 Compare Changes
[View all changes](https://github.com/Henrique-Coder/streamsnapper/compare/${{ steps.previoustag.outputs.tag }}...v${{ steps.version.outputs.version }})
[View all changes](https://github.com/henrique-coder/streamsnapper/compare/${{ steps.previoustag.outputs.tag }}...v${{ steps.version.outputs.version }})
draft: false
prerelease: false
env:
Expand Down
32 changes: 0 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,45 +12,13 @@ StreamSnapper is an intuitive library designed to simplify, enhance, and organiz

```bash
pip install -U streamsnapper # It does not have any features by default, but it can be extended with optional features
pip install -U streamsnapper[downloader] # It has the feature of downloading online content with support for multiple simultaneous connections
pip install -U streamsnapper[merger] # It has the feature of merging video files with audio files using FFmpeg (currently it does not need any dependencies)
pip install -U streamsnapper[youtube] # It has advanced features to extract data from YouTube, with support for several other features
pip install -U streamsnapper[all] # It has all features available at once
```

### Example Usage

#### `streamsnapper[downloader]`

```python
from streamsnapper import Downloader
from pathlib import Path # Optional


# A class for downloading direct download URLs.
downloader = Downloader(
# Initialize the Downloader class with the required settings for downloading a file.
max_connections='auto', # The maximum number of connections to use for downloading the file. (default: 'auto')
connection_speed=80, # The connection speed in Mbps. (default: 80)
overwrite=True, # Overwrite the file if it already exists. Otherwise, a "_1", "_2", etc. suffix will be added. (default: True)
show_progress_bar=True, # Show or hide the download progress bar. (default: True)
custom_headers=None, # Custom headers to include in the request. If None, default headers will be used. Imutable headers are 'Accept-Encoding' and 'Range'. (default: None)
timeout=None # Timeout in seconds for the download process. Or None for no timeout. (default: None)
)

# Downloads a file from the provided URL to the output file path.
# - If the output_path is a directory, the file name will be generated from the server response.
# - If the output_path is a file, the file will be saved with the provided name.
# - If not provided, the file will be saved to the current working directory.
downloader.download(
url='https://example.com/file', # The download URL to download the file from. (required)
output_path=Path.cwd() # The path to save the downloaded file to. If the path is a directory, the file name will be generated from the server response. If the path is a file, the file will be saved with the provided name. If not provided, the file will be saved to the current working directory. (default: Path.cwd())
)

# All functions are documented and have detailed typings, use your development IDE to learn more.

```

#### `streamsnapper[merger]`

```python
Expand Down
23 changes: 19 additions & 4 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 3 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,15 @@ classifiers = [
[tool.poetry.dependencies]
python = "^3.9"
httpx = { version = "0.28.1", optional = true }
rich = { version = "13.9.4", optional = true }
scrapetube = { version = "2.5.1", optional = true }
tenacity = { version = "9.0.0", optional = true }
turbodl = { version = "0.0.1", optional = true }
yt-dlp = { version = "2024.12.13", optional = true }

[tool.poetry.dev-dependencies]
orjson = "*"
pytest = "*"

[tool.poetry.extras]
downloader = ["httpx", "rich", "tenacity"]
merger = []
youtube = ["httpx", "rich", "scrapetube", "tenacity", "yt-dlp"]
all = ["httpx", "rich", "scrapetube", "tenacity", "yt-dlp"]
youtube = ["httpx", "scrapetube", "turbodl", "yt-dlp"]
all = ["httpx", "scrapetube", "turbodl", "yt-dlp"]
3 changes: 1 addition & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
httpx == 0.28.1
rich == 13.9.4
scrapetube == 2.5.1
tenacity == 9.0.0
turbodl == 0.0.1
yt-dlp == 2024.12.13
10 changes: 2 additions & 8 deletions streamsnapper/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,25 @@
from typing import List

# Local imports
from .downloader import Downloader
from .exceptions import (
DownloadError,
EmptyDataError,
FFmpegNotFoundError,
InvalidDataError,
MergeError,
RequestError,
ScrapingError,
StreamBaseError,
StreamSnapperError,
)
from .merger import Merger
from .platforms.youtube import YouTube, YouTubeExtractor


__all__: List[str] = [
'Downloader',
'DownloadError',
'EmptyDataError',
'FFmpegNotFoundError',
'InvalidDataError',
'MergeError',
'RequestError',
'ScrapingError',
'StreamBaseError',
'StreamSnapperError',
'Merger',
'YouTube',
'YouTubeExtractor',
Expand Down
Loading

0 comments on commit 9752cb1

Please sign in to comment.