youtube-up


Nameyoutube-up JSON
Version 0.4.0 PyPI version JSON
download
home_pagehttps://github.com/7x11x13/youtube-up
SummaryUpload videos to YouTube using the internal YouTube API
upload_time2024-03-23 23:34:53
maintainerNone
docs_urlNone
author7x11x13
requires_python<4.0,>=3.7
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.

# Installation

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

`pip install youtube-up`

# 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.7",
    "maintainer_email": null,
    "keywords": "YouTube, upload",
    "author": "7x11x13",
    "author_email": "x7x11x13@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/fb/57/af3c8219716edfbfc8940ac3bd8ab81db9fe556d65f2f5365ad03f77410b/youtube_up-0.4.0.tar.gz",
    "platform": null,
    "description": "# youtube-up\n\nUpload videos to YouTube using the internal YouTube API.\n\n# Installation\n\nFrom [PyPI:](https://pypi.org/project/youtube-up/)\n\n`pip install youtube-up`\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",
    "version": "0.4.0",
    "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": "6bd411210ab012a218d7fc70705ad7d0628d3bb6465f663392ed94e2fb036f23",
                "md5": "1428227ed662bf3bde800e1ce3c7c867",
                "sha256": "dd2fa65afa0ae1fe068cb3c2520e3216a546090e525b7924794e2ded145f5e41"
            },
            "downloads": -1,
            "filename": "youtube_up-0.4.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "1428227ed662bf3bde800e1ce3c7c867",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.7",
            "size": 20941,
            "upload_time": "2024-03-23T23:34:51",
            "upload_time_iso_8601": "2024-03-23T23:34:51.818389Z",
            "url": "https://files.pythonhosted.org/packages/6b/d4/11210ab012a218d7fc70705ad7d0628d3bb6465f663392ed94e2fb036f23/youtube_up-0.4.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fb57af3c8219716edfbfc8940ac3bd8ab81db9fe556d65f2f5365ad03f77410b",
                "md5": "9842d47190fb9354a3e8990e0183bd99",
                "sha256": "61c64488e576c1092522a64d9a047cc7ae28c6ada30dab054b068c428f2adff2"
            },
            "downloads": -1,
            "filename": "youtube_up-0.4.0.tar.gz",
            "has_sig": false,
            "md5_digest": "9842d47190fb9354a3e8990e0183bd99",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.7",
            "size": 18403,
            "upload_time": "2024-03-23T23:34:53",
            "upload_time_iso_8601": "2024-03-23T23:34:53.501789Z",
            "url": "https://files.pythonhosted.org/packages/fb/57/af3c8219716edfbfc8940ac3bd8ab81db9fe556d65f2f5365ad03f77410b/youtube_up-0.4.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-23 23:34:53",
    "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: 0.21067s