Skip to main content

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


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.1.tar.gz (29.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

yt_upload-0.1-py3-none-any.whl (38.7 kB view details)

Uploaded Python 3

File details

Details for the file yt_upload-0.1.tar.gz.

File metadata

  • Download URL: yt_upload-0.1.tar.gz
  • Upload date:
  • Size: 29.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.11.8 Windows/10

File hashes

Hashes for yt_upload-0.1.tar.gz
Algorithm Hash digest
SHA256 e55ce8251e7b33dbac36de1caef9f0b8012c509bb84c379b8207774e95acbcd9
MD5 d1b1ecfce4b59e30d9b57ef8080e2993
BLAKE2b-256 c0279652004719d7433f7c87977487ba41ac1fd90b5057c2dac6457ece337cfb

See more details on using hashes here.

File details

Details for the file yt_upload-0.1-py3-none-any.whl.

File metadata

  • Download URL: yt_upload-0.1-py3-none-any.whl
  • Upload date:
  • Size: 38.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.11.8 Windows/10

File hashes

Hashes for yt_upload-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ff13a1ea0ebf43dafefd8745b62fe34442f771d2e5755490e0647eab9bc7a42b
MD5 1ad125e382257bb7ccd83991215b69ee
BLAKE2b-256 c64b05be40a3c1811a5030db8acc0714fc45962b6094384a7142df047097717f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page