youtube-up


Nameyoutube-up JSON
Version 0.5.4 PyPI version JSON
download
home_pagehttps://github.com/7x11x13/youtube-up
SummaryUpload videos to YouTube using the internal YouTube API. Does not require an API key.
upload_time2024-07-22 18:44:33
maintainerNone
docs_urlNone
author7x11x13
requires_python<4.0,>=3.10
licenseNone
keywords youtube upload
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # youtube-up

Upload videos to YouTube using the internal YouTube API. Does not require an API key.

# Installation

From [PyPI:](https://pypi.org/project/youtube-up/)

`pip install youtube-up`

## Installing certificates

On your first run you may get an error which says `Was not able to load https://youtube.com. Have you installed the certificate at {cert_path} ?`.
If this happens you should follow the instructions at https://docs.mitmproxy.org/stable/concepts-certificates/#installing-the-mitmproxy-ca-certificate-manually
to install the certificate at the given path.

# Documentation

https://7x11x13.xyz/youtube-up/youtube_up

# Examples

## Upload a video
```python
from youtube_up import AllowCommentsEnum, Metadata, PrivacyEnum, YTUploaderSession

uploader = YTUploaderSession.from_cookies_txt("cookies/cookies.txt")
metadata = Metadata(
    title="Video title",
    description="Video description",
    privacy=PrivacyEnum.PUBLIC,
    made_for_kids=False,
    allow_comments_mode=AllowCommentsEnum.HOLD_ALL,
)
uploader.upload("video.webm", metadata)
```
Note that for Enum-type parameters we can either pass the Enum itself (as shown above),
or the Enum value, or the Enum key, as a string. For example, instead of writing

`allow_comments_mode=AllowCommentsEnum.HOLD_ALL`

we could instead write `allow_comments_mode="HOLD_ALL"`
or `allow_comments_mode="APPROVED_COMMENTS"`

### Note about cookies.txt format
The cookies file must be in [Netscape cookies.txt](https://docs.cyotek.com/cyowcopy/current/netscapecookieformat.html) format. See the following browser extensions for exporting cookies in the correct format:

- [Firefox](https://addons.mozilla.org/en-US/firefox/addon/cookies-txt)
- [Chrome](https://chromewebstore.google.com/detail/get-cookiestxt-locally/cclelndahbckbenkjhflpdbgdldlbecc)

## Upload multiple videos
```python
from youtube_up import Metadata, YTUploaderSession

uploader = YTUploaderSession.from_cookies_txt("cookies/cookies.txt")
metadata_1 = Metadata(
    title="Video 1",
)
metadata_2 = Metadata(
    title="Video 2",
)
uploader.upload("video1.webm", metadata_1)
uploader.upload("video2.webm", metadata_2)
```

## Upload to a new or existing playlist
```python
from youtube_up import Metadata, YTUploaderSession, Playlist

uploader = YTUploaderSession.from_cookies_txt("cookies/cookies.txt")
metadata = Metadata(
    title="Video 1",
    playlists=[
        Playlist(
            "Songs by me",
            description="Playlist that will only be created if "
            "no playlist exists with the title 'Songs by me'",
            create_if_title_doesnt_exist=True,
            create_if_title_exists=False,
        ),
        Playlist(
            "test playlist",
            description="Playlist that video will be added to "
            "only if it exists already. This description does "
            "nothing.",
            create_if_title_doesnt_exist=False,
            create_if_title_exists=False,
        ),
        Playlist(
            "Album",
            description="Playlist will be created even if there"
            " is already a playlist with the name 'Album'"
            create_if_title_doesnt_exist=True,
            create_if_title_exists=True,
        ),
    ],
)
uploader.upload("video.webm", metadata)
```

## CLI
youtube-up comes with a CLI app for uploading videos. For example, if we wanted to
create a public video with the title "Video title", we would execute the following command:
`youtube-up video video.webm --title="Video title" --cookies_file="cookies/cookies.txt" --privacy="PUBLIC"`

The app can also take a JSON file as input. For example, the following JSON file would upload
one video to a new or existing playlist called "Music" and one video which is set to premiere
on December 25th, 2023 at 5 PM (local time).

```json
[
    {
        "file": "song.webm",
        "metadata": {
            "title": "New song",
            "privacy": "PUBLIC",
            "playlists": [
                {
                    "title": "Music"
                }
            ]
        }
    },
    {
        "file": "premiere.webm",
        "metadata": {
            "title": "Special Announcement",
            "scheduled_upload": "2023-12-25T17:00:00",
            "premiere_countdown_duration": "ONE_MIN",
            "premiere_theme": "BRIGHT"
        }
    }
]
```

If we wanted the video to premiere at 5 PM GMT, would could have written "2023-12-25T17:00:00+00:00"
instead. We then run

`youtube-up json metadata.json --cookies_file="cookies/cookies.txt"`

to upload these videos.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/7x11x13/youtube-up",
    "name": "youtube-up",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.10",
    "maintainer_email": null,
    "keywords": "YouTube, upload",
    "author": "7x11x13",
    "author_email": "x7x11x13@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/c8/e0/caa6e84b098b9ee6198604cf5f6e32059402437871f594cd77ad0dd22734/youtube_up-0.5.4.tar.gz",
    "platform": null,
    "description": "# youtube-up\n\nUpload videos to YouTube using the internal YouTube API. Does not require an API key.\n\n# Installation\n\nFrom [PyPI:](https://pypi.org/project/youtube-up/)\n\n`pip install youtube-up`\n\n## Installing certificates\n\nOn your first run you may get an error which says `Was not able to load https://youtube.com. Have you installed the certificate at {cert_path} ?`.\nIf this happens you should follow the instructions at https://docs.mitmproxy.org/stable/concepts-certificates/#installing-the-mitmproxy-ca-certificate-manually\nto install the certificate at the given path.\n\n# Documentation\n\nhttps://7x11x13.xyz/youtube-up/youtube_up\n\n# Examples\n\n## Upload a video\n```python\nfrom youtube_up import AllowCommentsEnum, Metadata, PrivacyEnum, YTUploaderSession\n\nuploader = YTUploaderSession.from_cookies_txt(\"cookies/cookies.txt\")\nmetadata = Metadata(\n    title=\"Video title\",\n    description=\"Video description\",\n    privacy=PrivacyEnum.PUBLIC,\n    made_for_kids=False,\n    allow_comments_mode=AllowCommentsEnum.HOLD_ALL,\n)\nuploader.upload(\"video.webm\", metadata)\n```\nNote that for Enum-type parameters we can either pass the Enum itself (as shown above),\nor the Enum value, or the Enum key, as a string. For example, instead of writing\n\n`allow_comments_mode=AllowCommentsEnum.HOLD_ALL`\n\nwe could instead write `allow_comments_mode=\"HOLD_ALL\"`\nor `allow_comments_mode=\"APPROVED_COMMENTS\"`\n\n### Note about cookies.txt format\nThe cookies file must be in [Netscape cookies.txt](https://docs.cyotek.com/cyowcopy/current/netscapecookieformat.html) format. See the following browser extensions for exporting cookies in the correct format:\n\n- [Firefox](https://addons.mozilla.org/en-US/firefox/addon/cookies-txt)\n- [Chrome](https://chromewebstore.google.com/detail/get-cookiestxt-locally/cclelndahbckbenkjhflpdbgdldlbecc)\n\n## Upload multiple videos\n```python\nfrom youtube_up import Metadata, YTUploaderSession\n\nuploader = YTUploaderSession.from_cookies_txt(\"cookies/cookies.txt\")\nmetadata_1 = Metadata(\n    title=\"Video 1\",\n)\nmetadata_2 = Metadata(\n    title=\"Video 2\",\n)\nuploader.upload(\"video1.webm\", metadata_1)\nuploader.upload(\"video2.webm\", metadata_2)\n```\n\n## Upload to a new or existing playlist\n```python\nfrom youtube_up import Metadata, YTUploaderSession, Playlist\n\nuploader = YTUploaderSession.from_cookies_txt(\"cookies/cookies.txt\")\nmetadata = Metadata(\n    title=\"Video 1\",\n    playlists=[\n        Playlist(\n            \"Songs by me\",\n            description=\"Playlist that will only be created if \"\n            \"no playlist exists with the title 'Songs by me'\",\n            create_if_title_doesnt_exist=True,\n            create_if_title_exists=False,\n        ),\n        Playlist(\n            \"test playlist\",\n            description=\"Playlist that video will be added to \"\n            \"only if it exists already. This description does \"\n            \"nothing.\",\n            create_if_title_doesnt_exist=False,\n            create_if_title_exists=False,\n        ),\n        Playlist(\n            \"Album\",\n            description=\"Playlist will be created even if there\"\n            \" is already a playlist with the name 'Album'\"\n            create_if_title_doesnt_exist=True,\n            create_if_title_exists=True,\n        ),\n    ],\n)\nuploader.upload(\"video.webm\", metadata)\n```\n\n## CLI\nyoutube-up comes with a CLI app for uploading videos. For example, if we wanted to\ncreate a public video with the title \"Video title\", we would execute the following command:\n`youtube-up video video.webm --title=\"Video title\" --cookies_file=\"cookies/cookies.txt\" --privacy=\"PUBLIC\"`\n\nThe app can also take a JSON file as input. For example, the following JSON file would upload\none video to a new or existing playlist called \"Music\" and one video which is set to premiere\non December 25th, 2023 at 5 PM (local time).\n\n```json\n[\n    {\n        \"file\": \"song.webm\",\n        \"metadata\": {\n            \"title\": \"New song\",\n            \"privacy\": \"PUBLIC\",\n            \"playlists\": [\n                {\n                    \"title\": \"Music\"\n                }\n            ]\n        }\n    },\n    {\n        \"file\": \"premiere.webm\",\n        \"metadata\": {\n            \"title\": \"Special Announcement\",\n            \"scheduled_upload\": \"2023-12-25T17:00:00\",\n            \"premiere_countdown_duration\": \"ONE_MIN\",\n            \"premiere_theme\": \"BRIGHT\"\n        }\n    }\n]\n```\n\nIf we wanted the video to premiere at 5 PM GMT, would could have written \"2023-12-25T17:00:00+00:00\"\ninstead. We then run\n\n`youtube-up json metadata.json --cookies_file=\"cookies/cookies.txt\"`\n\nto upload these videos.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Upload videos to YouTube using the internal YouTube API. Does not require an API key.",
    "version": "0.5.4",
    "project_urls": {
        "Documentation": "https://7x11x13.xyz/youtube-up/youtube_up",
        "Homepage": "https://github.com/7x11x13/youtube-up",
        "Repository": "https://github.com/7x11x13/youtube-up"
    },
    "split_keywords": [
        "youtube",
        " upload"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c824b7be3189ea19b93637c0f2671334ba9b29961b5db05b17387d0d42f026cd",
                "md5": "4fb61081b6a54068b71efcfc651c13b7",
                "sha256": "5ea5a3a7d2ecfa489a1b62de86b73574bb27a825d2f74aab19c432a6b3f18a5f"
            },
            "downloads": -1,
            "filename": "youtube_up-0.5.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "4fb61081b6a54068b71efcfc651c13b7",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.10",
            "size": 20029,
            "upload_time": "2024-07-22T18:44:31",
            "upload_time_iso_8601": "2024-07-22T18:44:31.561569Z",
            "url": "https://files.pythonhosted.org/packages/c8/24/b7be3189ea19b93637c0f2671334ba9b29961b5db05b17387d0d42f026cd/youtube_up-0.5.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c8e0caa6e84b098b9ee6198604cf5f6e32059402437871f594cd77ad0dd22734",
                "md5": "5ce33c5940f02b840da6d6c57176bcb6",
                "sha256": "bd25ab3bcbfefeefa75ee5584f99fcc9dca6fa17fc7c996e18a242ab530c6bef"
            },
            "downloads": -1,
            "filename": "youtube_up-0.5.4.tar.gz",
            "has_sig": false,
            "md5_digest": "5ce33c5940f02b840da6d6c57176bcb6",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.10",
            "size": 17645,
            "upload_time": "2024-07-22T18:44:33",
            "upload_time_iso_8601": "2024-07-22T18:44:33.101122Z",
            "url": "https://files.pythonhosted.org/packages/c8/e0/caa6e84b098b9ee6198604cf5f6e32059402437871f594cd77ad0dd22734/youtube_up-0.5.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-07-22 18:44:33",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "7x11x13",
    "github_project": "youtube-up",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "youtube-up"
}
        
Elapsed time: 2.29960s