A Python package to interact with YouTube Data API v3.
Project description
YouTube Gears
A Python package for uploading videos to YouTube.
Service Setup
- https://console.cloud.google.com/apis/library
- YouTube Data API v3
- https://console.cloud.google.com/apis/credentials
- OAuth 2.0 Client ID
- Application type: Desktop App
- Download the client secret file (JSON)
- OAuth 2.0 Client ID
Example
import logging
import tqdm
import ytb_gears
def main():
logging.basicConfig(level=logging.INFO)
client_secret_file = "client_secret.json"
video_path = "test.mp4"
thumbnail_path = "thumbnail.jpg"
if ytb_gears.today_already_uploaded(client_secret_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)
resource = ytb_gears.upload(
video_path,
client_secret_file,
"YouTube Gears Test Video",
"Uploaded by YouTube Gears",
["ytb-gears", "test"],
"22",
"unlisted",
progress_callback=update_progress,
)
ytb_gears.set_thumbnail(
resource["id"],
thumbnail_path,
client_secret_file,
)
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
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
ytb_gears-0.3.0.tar.gz
(16.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
File details
Details for the file ytb_gears-0.3.0.tar.gz.
File metadata
- Download URL: ytb_gears-0.3.0.tar.gz
- Upload date:
- Size: 16.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7a128acad8fa7e34517140c9d9bc2f1b8dc0bf1390c610ccc574ba24aef946f6
|
|
| MD5 |
04e837e26f3aeaf4c12172ecd50f0675
|
|
| BLAKE2b-256 |
7e7ff3c160c92d9f3e2e4b462b11d2e421596ec619c41c106f8fe110afe16674
|
File details
Details for the file ytb_gears-0.3.0-py3-none-any.whl.
File metadata
- Download URL: ytb_gears-0.3.0-py3-none-any.whl
- Upload date:
- Size: 4.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8d1c941f2790f1018172723c0cfcf2f044ade1f91051837cb964cdcefe51f11a
|
|
| MD5 |
669fbe80f7e7f09023b7ed3e5d73a313
|
|
| BLAKE2b-256 |
cb2f44598320fee40d5b0fb81b8351324775fd16c2d4aed10beb287e83859d6f
|