Skip to main content

A Python package to interact with YouTube Data API v3.

Project description

YouTube Gears

A Python package for uploading videos to YouTube.

Service Setup

Example

import logging

import tqdm

from ytb_gears import uploader


def main():
    logging.basicConfig(level=logging.WARNING)
    logging.getLogger("ytb_gears").setLevel(logging.INFO)

    credentials_file = "credentials.json"
    video_path = "test.mp4"
    thumbnail_path = "thumbnail.jpg"

    videos = uploader.list_videos(credentials_file, max_results=10)
    for video in videos:
        print(f"id: {video['id']['videoId']}")
        print(f"title: {video['snippet']['title']}")
        print(f"date: {video['snippet']['publishedAt']}")
        print(f"description: {video['snippet']['description']}")
        print("-" * 40)

    if uploader.today_already_uploaded(credentials_file):
        return

    print(f"即将上传视频: {video_path}")

    with tqdm.tqdm(total=100) as pbar:

        def update_progress(progress: float):
            pbar.update(int(progress * 100) - pbar.n)

        uploader.upload(
            video_path,
            credentials_file,
            "YouTube Gears Test Video",
            thumbnail_path,
            "Uploaded by YouTube Gears",
            ["ytb-gears", "test"],
            "22",
            "unlisted",
            progress_callback=update_progress,
        )


main()

Proxy

import os

os.environ["HTTP_PROXY"] = "http://127.0.0.1:7890"
os.environ["HTTPS_PROXY"] = "http://127.0.0.1:7890"

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

ytb_gears-0.6.0.tar.gz (24.1 kB view details)

Uploaded Source

Built Distribution

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

ytb_gears-0.6.0-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file ytb_gears-0.6.0.tar.gz.

File metadata

  • Download URL: ytb_gears-0.6.0.tar.gz
  • Upload date:
  • Size: 24.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.21

File hashes

Hashes for ytb_gears-0.6.0.tar.gz
Algorithm Hash digest
SHA256 eabd13ba9fac53dd15ee701044bd75fca00f259833792e41befcc1f126ad0f64
MD5 3b0bfabc595848f8c33fa3a9089717ea
BLAKE2b-256 37d498938068b503babd7efa70758c8f7c834376945d110c876230874e799435

See more details on using hashes here.

File details

Details for the file ytb_gears-0.6.0-py3-none-any.whl.

File metadata

  • Download URL: ytb_gears-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 4.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.21

File hashes

Hashes for ytb_gears-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cf7b51c4d41a61d9325cb980d9a6ab1fcb6f6092ae74a677d2e1ce02e1c943ad
MD5 03bbdadb5a23661acf0fa2ef9f5f0d6b
BLAKE2b-256 440e62e27347969c1c3a43b739989b414d9eb32ab76b36a4e49400da2a667583

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