forked from nang-dev/automated_youtube_channel
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupload_video.py
More file actions
56 lines (44 loc) · 1.49 KB
/
upload_video.py
File metadata and controls
56 lines (44 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
from simple_youtube_api.Channel import Channel
from simple_youtube_api.LocalVideo import LocalVideo
from simple_youtube_api.YouTube import YouTube
from config import *
import logging
client_secrets_file = "./assets/secrets.json"
scopes = ["https://www.googleapis.com/auth/youtube.upload"]
api_service_name = "youtube"
api_version = "v3"
def upload_video(
account = ACCOUNTNAME,
channel = CHANNELNAME,
title = TITLE,
description = DESCRIPTION,
keywords = KEYWORDS,
category = CATEGORY,
privacyStatus = PRIVACYSTATUS,
video_path = OUTPUTPATH,
):
channel = Channel()
channel.login("./assets/secrets.json", "./assets/credentials.storage")
# setting up the video that is going to be uploaded
video = LocalVideo(file_path=video_path)
# setting snippet
video.set_title(title)
video.set_description(description)
video.set_tags(list(keywords))
video.set_category(category)
video.set_default_language("en-US")
# setting status
video.set_embeddable(True)
video.set_license("creativeCommon")
video.set_privacy_status(privacyStatus)
video.set_public_stats_viewable(True)
video.set_made_for_kids(False)
# setting thumbnail
video.set_thumbnail_path("./assets/Template.png")
# Upload video
video = channel.upload_video(video)
logging.info(f"Video uploaded: {video.title} - {video.id} [{MONTH}/{NOW.day}/{NOW.year}]")
# Like video
video.like()
if __name__ == "__main__":
upload_video()