No project description provided
Project description
YouTube upload
Key Features
- Not using YouTube APIv3
- Allowing customization of all YouTube video settings
- Logging video uploads
- Supports headless operation
- Supports asynchronous video uploads
Installation
# install youtube-upload
pip install yt-upload
# install chrome browser
playwright install chrome
Getting started
Upload video
To upload some video:
# exmaples/upload_video.py
import asyncio
import yt_upload as yt
import datetime as dt
async def main():
channel = yt.Channel(
user_data_dir="User Data",
profile="Profile 1",
cookies_path="cookies.json"
)
video = yt.Video(
video_path="video.mp4",
title="Funny video",
made_for_kids=False,
category=yt.category.PETS_ANIMALS,
visibility=yt.visibility.PUBLIC,
tags=["animals", "cats", "funny"],
schedule=dt.datetime.now() + dt.timedelta(days=1)
)
async with channel() as upload:
await upload.upload_video(video)
asyncio.run(main())
Upload videos
to upload multiple videos asynchronously:
# examples/upload_videos.py
video1 = yt.Video(
video_path="video1.mp4",
title="Funny video 1",
made_for_kids=False,
category=yt.category.PETS_ANIMALS,
visibility=yt.visibility.PUBLIC,
)
video2 = yt.Video(
video_path="video2.mp4",
title="Funny video 2",
made_for_kids=False,
category=yt.category.PETS_ANIMALS,
visibility=yt.visibility.PUBLIC,
)
async with channel() as upload:
await upload.upload_videos([video1, video2])
YouTube video settings
An example YouTube video settings:
# examples/youtube_video_settings.py.py
video = yt.Video(
video_path="video.mp4",
title="Funny video",
description="Funny video about math #math",
made_for_kids=False,
category=yt.category.EDUCATION,
visibility=yt.visibility.PUBLIC,
age_restriction=True,
thumbnail="thumbnail.png",
playlist=["math", ],
tags=["math"],
contains_paid_promotion=True,
allow_automatic_chapters_and_key=False,
allow_automatic_places=True,
allow_automatic_concepts=False,
allow_embedding=True,
publish_to_subscriptions_feed=True,
show_viewer_like=True,
allow_only_audio_remixing=True,
video_language=yt.language.ENGLISH,
caption_certification=yt.caption_certification.CONTENT_HAS_NOT_AIRED,
recording_date=dt.date(2023, 10, 10),
video_location="Los Angeles",
license=yt.licence.STANDARD_YOUTUBE,
education_type=yt.education_type.LECTURE,
education_academic_system=yt.education_academic_system.UNITED_STATES,
education_problems=[
(dt.timedelta(seconds=5), "derivative"),
(dt.timedelta(minutes=3, seconds=2), "integral")
],
education_level="College",
education_exam="SAT Math",
show_comments=True,
comment_moderation=yt.comment_moderation.HOLD_ALL,
sort_by=yt.sort_by.NEWEST,
schedule=dt.datetime.now() + dt.timedelta(days=7)
)
Logging configure
An example using a logging:
# examples/logging_configure.py
logging_config = {
"filename": "yt_log.jsonl",
"maxBytes": 10000,
"backupCount": 3,
}
async with channel(enable_logging=True, **logging_config) as upload:
await upload.upload_video(video)
Requirements
License
This project is licensed under the MIT License. See the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
yt_upload-0.2.tar.gz
(29.2 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
yt_upload-0.2-py3-none-any.whl
(39.0 kB
view details)
File details
Details for the file yt_upload-0.2.tar.gz.
File metadata
- Download URL: yt_upload-0.2.tar.gz
- Upload date:
- Size: 29.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.11.8 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7ef82c679d9a68ce28bf6165fb4241445742c908f009ed382c4dac42f65db04c
|
|
| MD5 |
2e5c6411f12c0d072ab73e49ab1cae2d
|
|
| BLAKE2b-256 |
ce0ae76e89cb3509dfcd5eb14770726f4bb251955644782db6ba88004adfe1a8
|
File details
Details for the file yt_upload-0.2-py3-none-any.whl.
File metadata
- Download URL: yt_upload-0.2-py3-none-any.whl
- Upload date:
- Size: 39.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.11.8 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e988d20f6ab9b906b3d81cd6620b88addf63d7ac8bffc10f053ecb68bd5a93a0
|
|
| MD5 |
be9cec698b614a5d96f4313fbb65771d
|
|
| BLAKE2b-256 |
875513053b7bb887d6bd397acb5ba3717f8438db6dfb380878b1b81ffc875eb6
|