pytubefix


Namepytubefix JSON
Version 5.3.0 PyPI version JSON
download
home_pageNone
SummaryPython3 library for downloading YouTube Videos.
upload_time2024-04-30 00:53:50
maintainerNone
docs_urlNone
authorNone
requires_python>=3.7
licenseMIT 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)
![PyPI - License](https://img.shields.io/pypi/l/pytubefix)
![Read the Docs](https://img.shields.io/readthedocs/pytubefix)
![GitHub Tag](https://img.shields.io/github/v/tag/JuanBindez/pytubefix?include_prereleases)
<a href="https://pypi.org/project/pytubefix/"><img src="https://img.shields.io/pypi/v/pytubefix" /></a>


## A pytube fork with additional features and fixes.

----------
## install

    pip install pytubefix


## Quickstart

#### mp4 video download 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()
```

#### If you want to save in .mp3 just pass the mp3=True parameter (MPEG-4 AAC audio codec):

```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(mp3=True) # pass the parameter mp3=True to save in .mp3
```

#### if you want to download complete playlists:

```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(mp3=True) # pass the parameter mp3=True to save in .mp3

```

#### if you want to add 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_audio_only()

ys.download(mp3=True) # you will only get the request to authenticate once you download

```

## Subtitle/Caption Tracks:

#### viewing available subtitles:

```python

from pytubefix import YouTube

yt = YouTube('http://youtube.com/watch?v=2lAe1cqCOXo')
subtitles = yt.captions

print(subtitles)

```

#### printing the subtitle tracks:

```python

from pytubefix import YouTube
 

yt = YouTube('http://youtube.com/watch?v=2lAe1cqCOXo')

caption = yt.captions.get_by_language_code('en')
print(caption.generate_srt_captions())

```

#### now you can save subtitles to a txt file:

```python

from pytubefix import YouTube
 

yt = YouTube('http://youtube.com/watch?v=2lAe1cqCOXo')

caption = yt.captions.get_by_language_code('en')
caption.save_captions("captions.txt")

```

## Using Channels:

#### get the channel name:

```python

from pytubefix import Channel

c = Channel("https://www.youtube.com/@ProgrammingKnowledge/featured")

print(f'Channel name: {c.channel_name}')

```

#### to 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:
    download = video.streams.get_highest_resolution().download()

```


            

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/dc/1c/0301b477403377258a95c551edc7be20f2f746e800316d38e3eb43bd346a/pytubefix-5.3.0.tar.gz",
    "platform": null,
    "description": "# pytubefix\n![PyPI - Downloads](https://img.shields.io/pypi/dm/pytubefix)\n![PyPI - License](https://img.shields.io/pypi/l/pytubefix)\n![Read the Docs](https://img.shields.io/readthedocs/pytubefix)\n![GitHub Tag](https://img.shields.io/github/v/tag/JuanBindez/pytubefix?include_prereleases)\n<a href=\"https://pypi.org/project/pytubefix/\"><img src=\"https://img.shields.io/pypi/v/pytubefix\" /></a>\n\n\n## A pytube fork with additional features and fixes.\n\n----------\n## install\n\n    pip install pytubefix\n\n\n## Quickstart\n\n#### mp4 video download highest resolution:\n\n```python\n\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#### If you want to save in .mp3 just pass the mp3=True parameter (MPEG-4 AAC audio codec):\n\n```python\n\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(mp3=True) # pass the parameter mp3=True to save in .mp3\n```\n\n#### if you want to download complete playlists:\n\n```python\n\nfrom pytubefix import Playlist\nfrom pytubefix.cli import on_progress\n \nurl = \"url\"\n\npl = Playlist(url)\n\nfor video in pl.videos:\n    ys = video.streams.get_audio_only()\n    ys.download(mp3=True) # pass the parameter mp3=True to save in .mp3\n\n```\n\n#### if you want to add authentication\n\n```python\n\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)\n           \nys = yt.streams.get_audio_only()\n\nys.download(mp3=True) # you will only get the request to authenticate once you download\n\n```\n\n## Subtitle/Caption Tracks:\n\n#### viewing available subtitles:\n\n```python\n\nfrom pytubefix import YouTube\n\nyt = YouTube('http://youtube.com/watch?v=2lAe1cqCOXo')\nsubtitles = yt.captions\n\nprint(subtitles)\n\n```\n\n#### printing the subtitle tracks:\n\n```python\n\nfrom pytubefix import YouTube\n \n\nyt = YouTube('http://youtube.com/watch?v=2lAe1cqCOXo')\n\ncaption = yt.captions.get_by_language_code('en')\nprint(caption.generate_srt_captions())\n\n```\n\n#### now you can save subtitles to a txt file:\n\n```python\n\nfrom pytubefix import YouTube\n \n\nyt = YouTube('http://youtube.com/watch?v=2lAe1cqCOXo')\n\ncaption = yt.captions.get_by_language_code('en')\ncaption.save_captions(\"captions.txt\")\n\n```\n\n## Using Channels:\n\n#### get the channel name:\n\n```python\n\nfrom pytubefix import Channel\n\nc = Channel(\"https://www.youtube.com/@ProgrammingKnowledge/featured\")\n\nprint(f'Channel name: {c.channel_name}')\n\n```\n\n#### to download all videos from a channel:\n\n\n```python\n\nfrom pytubefix import Channel\n\nc = Channel(\"https://www.youtube.com/@ProgrammingKnowledge\")\n\nprint(f'Downloading videos by: {c.channel_name}')\n\nfor video in c.videos:\n    download = video.streams.get_highest_resolution().download()\n\n```\n\n",
    "bugtrack_url": null,
    "license": "MIT license",
    "summary": "Python3 library for downloading YouTube Videos.",
    "version": "5.3.0",
    "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": "6cdf0ecc2f63f05b15dd3797b19eac22f405fc410cb12b6a4b0052f82f191dc2",
                "md5": "30011001b24acdc2e373d1099b378752",
                "sha256": "195f09922a8df1be44a476752546f905e35c24549fc573711204bdf14427d562"
            },
            "downloads": -1,
            "filename": "pytubefix-5.3.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "30011001b24acdc2e373d1099b378752",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 68801,
            "upload_time": "2024-04-30T00:53:47",
            "upload_time_iso_8601": "2024-04-30T00:53:47.494793Z",
            "url": "https://files.pythonhosted.org/packages/6c/df/0ecc2f63f05b15dd3797b19eac22f405fc410cb12b6a4b0052f82f191dc2/pytubefix-5.3.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "dc1c0301b477403377258a95c551edc7be20f2f746e800316d38e3eb43bd346a",
                "md5": "601271ebf361c42b7b70b8d4db185b79",
                "sha256": "a59e8fb8615af2a5226545f95df487bf54847a596c3183a61b029afee8544e3b"
            },
            "downloads": -1,
            "filename": "pytubefix-5.3.0.tar.gz",
            "has_sig": false,
            "md5_digest": "601271ebf361c42b7b70b8d4db185b79",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 73871,
            "upload_time": "2024-04-30T00:53:50",
            "upload_time_iso_8601": "2024-04-30T00:53:50.268094Z",
            "url": "https://files.pythonhosted.org/packages/dc/1c/0301b477403377258a95c551edc7be20f2f746e800316d38e3eb43bd346a/pytubefix-5.3.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-30 00:53:50",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "juanbindez",
    "github_project": "pytubefix",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "pytubefix"
}
        
Elapsed time: 0.25483s