youtube-up
Upload videos to YouTube using the internal YouTube API. Does not require an API key.
Installation
From PyPI:
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
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 format. See the following browser extensions for exporting cookies in the correct format:
Upload multiple videos
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
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).
[
{
"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.
Metadata
Release files for youtube-up 0.5.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| youtube_up-0.5.6.tar.gz | 18.3 kB | Without provenance | Details for youtube_up-0.5.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| youtube_up-0.5.6-py3-none-any.whl | Python 3 | none | any | Details for youtube_up-0.5.6-py3-none-any.whl |
Total release size: 39.1 kB
Release files / youtube_up-0.5.6.tar.gz
| Download URL | youtube_up-0.5.6.tar.gz |
|---|---|
| Size | 18.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fb9981692ba1af35ab76c7091a91d68d90f96b5bbfebcc64d7cbe25af4178761
|
|
BLAKE2b-256 checksum How to use checksums |
cbab6c6c8bb96839f4a50c12f6b24e29d92f47541289ecc8584a8eb8c090f896
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.0.0 CPython/3.11.0 Linux/6.8.0-1017-azure
|
Release files / youtube_up-0.5.6-py3-none-any.whl
| Download URL | youtube_up-0.5.6-py3-none-any.whl |
|---|---|
| Size | 20.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3dfecd2086b8af52386cdbf9f0cfb3999bdb5719895b537583db26204d384d22
|
|
BLAKE2b-256 checksum How to use checksums |
41f9a2282b2b4b34bae545d44dc486fcc56892c3e0c5f8c062a8afdbdda78744
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.0.0 CPython/3.11.0 Linux/6.8.0-1017-azure
|
Security for youtube-up 0.5.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.