Name | pytubefix JSON |
Version |
8.8.2
JSON |
| download |
home_page | None |
Summary | Python3 library for downloading YouTube Videos. |
upload_time | 2024-12-17 12:08:41 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.7 |
license | MIT license |
keywords |
youtube
download
video
stream
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# Pytubefix
[![PyPI - Downloads](https://img.shields.io/pypi/dm/pytubefix)](https://pypi.org/project/pytubefix/)
[![GitHub Sponsors](https://img.shields.io/github/sponsors/juanbindez)](https://github.com/sponsors/juanbindez)
[![PyPI - License](https://img.shields.io/pypi/l/pytubefix)](https://opensource.org/licenses/MIT)
[![Read the Docs](https://img.shields.io/readthedocs/pytubefix)](https://pytubefix.readthedocs.io/)
[![GitHub Tag](https://img.shields.io/github/v/tag/JuanBindez/pytubefix?include_prereleases)](https://github.com/JuanBindez/pytubefix/releases)
[![PyPI - Version](https://img.shields.io/pypi/v/pytubefix)](https://pypi.org/project/pytubefix/)
## Python3 Library for Downloading YouTube Videos
---
## Installation
```bash
pip install pytubefix
```
---
## Quickstart
### Download MP4 Video in Highest Resolution:
```python
from pytubefix import YouTube
from pytubefix.cli import on_progress
url = "url"
yt = YouTube(url, on_progress_callback=on_progress)
print(yt.title)
ys = yt.streams.get_highest_resolution()
ys.download()
```
### Download Audio-Only (.m4a):
```python
from pytubefix import YouTube
from pytubefix.cli import on_progress
url = "url"
yt = YouTube(url, on_progress_callback=on_progress)
print(yt.title)
ys = yt.streams.get_audio_only()
ys.download()
```
### Download a Complete Playlist:
```python
from pytubefix import Playlist
from pytubefix.cli import on_progress
url = "url"
pl = Playlist(url)
for video in pl.videos:
ys = video.streams.get_audio_only()
ys.download()
```
### Use OAuth Authentication:
```python
from pytubefix import YouTube
from pytubefix.cli import on_progress
url = "url"
yt = YouTube(url, use_oauth=True, allow_oauth_cache=True, on_progress_callback=on_progress)
ys = yt.streams.get_highest_resolution()
ys.download() # Authenticate once for subsequent downloads
```
### Specify Output Directory for Downloads:
```python
from pytubefix import YouTube
from pytubefix.cli import on_progress
url = "url"
yt = YouTube(url, on_progress_callback=on_progress)
ys = yt.streams.get_highest_resolution()
ys.download(output_path="path/to/directory")
```
---
## Working with Subtitles/Caption Tracks
### View Available Subtitles:
```python
from pytubefix import YouTube
yt = YouTube('http://youtube.com/watch?v=2lAe1cqCOXo')
print(yt.captions)
```
### Print Subtitle Tracks:
```python
from pytubefix import YouTube
yt = YouTube('http://youtube.com/watch?v=2lAe1cqCOXo')
caption = yt.captions['a.en']
print(caption.generate_srt_captions())
```
### Save Subtitles to a Text File:
```python
from pytubefix import YouTube
yt = YouTube('http://youtube.com/watch?v=2lAe1cqCOXo')
caption = yt.captions['a.en']
caption.save_captions("captions.txt")
```
---
## Using Channels
### Get Channel Name:
```python
from pytubefix import Channel
c = Channel("https://www.youtube.com/@ProgrammingKnowledge/featured")
print(f'Channel name: {c.channel_name}')
```
### Download All Videos from a Channel:
```python
from pytubefix import Channel
c = Channel("https://www.youtube.com/@ProgrammingKnowledge")
print(f'Downloading videos by: {c.channel_name}')
for video in c.videos:
video.streams.get_highest_resolution().download()
```
---
## Search for Videos
### Basic Search:
```python
from pytubefix import Search
results = Search('GitHub Issue Best Practices')
for video in results.videos:
print(f'Title: {video.title}')
print(f'URL: {video.watch_url}')
print(f'Duration: {video.length} sec')
print('---')
```
### Use Filters:
```python
from pytubefix.contrib.search import Search, Filter
filters = {
'upload_date': Filter.get_upload_date('Today'),
'type': Filter.get_type("Video"),
'duration': Filter.get_duration("Under 4 minutes"),
'features': [Filter.get_features("4K"), Filter.get_features("Creative Commons")],
'sort_by': Filter.get_sort_by("Upload date")
}
s = Search('music', filters=filters)
for video in s.videos:
print(video.watch_url)
```
Raw data
{
"_id": null,
"home_page": null,
"name": "pytubefix",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": "youtube, download, video, stream",
"author": null,
"author_email": "Juan Bindez <juanbindez780@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/4c/c3/695799bae143d93182cf462b1295cb5e42056e73e687df376b91f3125cd9/pytubefix-8.8.2.tar.gz",
"platform": null,
"description": "# Pytubefix\n\n[![PyPI - Downloads](https://img.shields.io/pypi/dm/pytubefix)](https://pypi.org/project/pytubefix/)\n[![GitHub Sponsors](https://img.shields.io/github/sponsors/juanbindez)](https://github.com/sponsors/juanbindez)\n[![PyPI - License](https://img.shields.io/pypi/l/pytubefix)](https://opensource.org/licenses/MIT)\n[![Read the Docs](https://img.shields.io/readthedocs/pytubefix)](https://pytubefix.readthedocs.io/)\n[![GitHub Tag](https://img.shields.io/github/v/tag/JuanBindez/pytubefix?include_prereleases)](https://github.com/JuanBindez/pytubefix/releases)\n[![PyPI - Version](https://img.shields.io/pypi/v/pytubefix)](https://pypi.org/project/pytubefix/)\n\n## Python3 Library for Downloading YouTube Videos\n\n---\n\n## Installation\n\n```bash\npip install pytubefix\n```\n\n---\n\n## Quickstart\n\n### Download MP4 Video in Highest Resolution:\n\n```python\nfrom pytubefix import YouTube\nfrom pytubefix.cli import on_progress\n\nurl = \"url\"\n\nyt = YouTube(url, on_progress_callback=on_progress)\nprint(yt.title)\n\nys = yt.streams.get_highest_resolution()\nys.download()\n```\n\n### Download Audio-Only (.m4a):\n\n```python\nfrom pytubefix import YouTube\nfrom pytubefix.cli import on_progress\n\nurl = \"url\"\n\nyt = YouTube(url, on_progress_callback=on_progress)\nprint(yt.title)\n\nys = yt.streams.get_audio_only()\nys.download()\n```\n\n### Download a Complete Playlist:\n\n```python\nfrom pytubefix import Playlist\nfrom pytubefix.cli import on_progress\n\nurl = \"url\"\n\npl = Playlist(url)\nfor video in pl.videos:\n ys = video.streams.get_audio_only()\n ys.download()\n```\n\n### Use OAuth Authentication:\n\n```python\nfrom pytubefix import YouTube\nfrom pytubefix.cli import on_progress\n\nurl = \"url\"\n\nyt = YouTube(url, use_oauth=True, allow_oauth_cache=True, on_progress_callback=on_progress)\nys = yt.streams.get_highest_resolution()\nys.download() # Authenticate once for subsequent downloads\n```\n\n### Specify Output Directory for Downloads:\n\n```python\nfrom pytubefix import YouTube\nfrom pytubefix.cli import on_progress\n\nurl = \"url\"\n\nyt = YouTube(url, on_progress_callback=on_progress)\nys = yt.streams.get_highest_resolution()\nys.download(output_path=\"path/to/directory\")\n```\n\n---\n\n## Working with Subtitles/Caption Tracks\n\n### View Available Subtitles:\n\n```python\nfrom pytubefix import YouTube\n\nyt = YouTube('http://youtube.com/watch?v=2lAe1cqCOXo')\nprint(yt.captions)\n```\n\n### Print Subtitle Tracks:\n\n```python\nfrom pytubefix import YouTube\n\nyt = YouTube('http://youtube.com/watch?v=2lAe1cqCOXo')\ncaption = yt.captions['a.en']\nprint(caption.generate_srt_captions())\n```\n\n### Save Subtitles to a Text File:\n\n```python\nfrom pytubefix import YouTube\n\nyt = YouTube('http://youtube.com/watch?v=2lAe1cqCOXo')\ncaption = yt.captions['a.en']\ncaption.save_captions(\"captions.txt\")\n```\n\n---\n\n## Using Channels\n\n### Get Channel Name:\n\n```python\nfrom pytubefix import Channel\n\nc = Channel(\"https://www.youtube.com/@ProgrammingKnowledge/featured\")\nprint(f'Channel name: {c.channel_name}')\n```\n\n### Download All Videos from a Channel:\n\n```python\nfrom pytubefix import Channel\n\nc = Channel(\"https://www.youtube.com/@ProgrammingKnowledge\")\nprint(f'Downloading videos by: {c.channel_name}')\n\nfor video in c.videos:\n video.streams.get_highest_resolution().download()\n```\n\n---\n\n## Search for Videos\n\n### Basic Search:\n\n```python\nfrom pytubefix import Search\n\nresults = Search('GitHub Issue Best Practices')\nfor video in results.videos:\n print(f'Title: {video.title}')\n print(f'URL: {video.watch_url}')\n print(f'Duration: {video.length} sec')\n print('---')\n```\n\n### Use Filters:\n\n```python\nfrom pytubefix.contrib.search import Search, Filter\n\nfilters = {\n 'upload_date': Filter.get_upload_date('Today'),\n 'type': Filter.get_type(\"Video\"),\n 'duration': Filter.get_duration(\"Under 4 minutes\"),\n 'features': [Filter.get_features(\"4K\"), Filter.get_features(\"Creative Commons\")],\n 'sort_by': Filter.get_sort_by(\"Upload date\")\n}\n\ns = Search('music', filters=filters)\nfor video in s.videos:\n print(video.watch_url)\n```\n",
"bugtrack_url": null,
"license": "MIT license",
"summary": "Python3 library for downloading YouTube Videos.",
"version": "8.8.2",
"project_urls": {
"Bug Reports": "https://github.com/juanbindez/pytubefix/issues",
"Homepage": "https://github.com/juanbindez/pytubefix",
"Read the Docs": "http://pytubefix.readthedocs.io/"
},
"split_keywords": [
"youtube",
" download",
" video",
" stream"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "64a1baa5f9793f3ddf453671e19cdaf0d1f15b225011c9ea4f62fa2d14869165",
"md5": "b24ac708e7421a2bc60749365b644a12",
"sha256": "a2e75def3d72004558829505a4f632915fa781834943d491bfe315d4fbc7c558"
},
"downloads": -1,
"filename": "pytubefix-8.8.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "b24ac708e7421a2bc60749365b644a12",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 85353,
"upload_time": "2024-12-17T12:08:37",
"upload_time_iso_8601": "2024-12-17T12:08:37.086098Z",
"url": "https://files.pythonhosted.org/packages/64/a1/baa5f9793f3ddf453671e19cdaf0d1f15b225011c9ea4f62fa2d14869165/pytubefix-8.8.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "4cc3695799bae143d93182cf462b1295cb5e42056e73e687df376b91f3125cd9",
"md5": "1d9b6be72a3d63c9b983ae2abf1541bb",
"sha256": "918d38b58024bdad34b0d2c12e35d37962764250ab37c7c126f1cc27db3b2225"
},
"downloads": -1,
"filename": "pytubefix-8.8.2.tar.gz",
"has_sig": false,
"md5_digest": "1d9b6be72a3d63c9b983ae2abf1541bb",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 88616,
"upload_time": "2024-12-17T12:08:41",
"upload_time_iso_8601": "2024-12-17T12:08:41.604864Z",
"url": "https://files.pythonhosted.org/packages/4c/c3/695799bae143d93182cf462b1295cb5e42056e73e687df376b91f3125cd9/pytubefix-8.8.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-17 12:08:41",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "juanbindez",
"github_project": "pytubefix",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "pytubefix"
}