understanding commited on
Commit
b6c28c9
·
verified ·
1 Parent(s): 6abe643

Create youtube/metadata.py

Browse files
Files changed (1) hide show
  1. bot/youtube/metadata.py +19 -0
bot/youtube/metadata.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # PATH: bot/youtube/metadata.py
2
+ def normalize_privacy(p: str) -> str:
3
+ p = (p or "private").lower().strip()
4
+ if p not in ("private", "unlisted", "public"):
5
+ return "private"
6
+ return p
7
+
8
+ def build_metadata(title: str, description: str, privacy: str = "private") -> dict:
9
+ privacy = normalize_privacy(privacy)
10
+ return {
11
+ "snippet": {
12
+ "title": title[:95],
13
+ "description": description[:4900],
14
+ "categoryId": "22", # People & Blogs default
15
+ },
16
+ "status": {
17
+ "privacyStatus": privacy
18
+ }
19
+ }