Matej Helgard
Matej Helgard

Reputation: 33

Upload video on youtube without youtube API in python

Is it possible to upload a video on YouTube without YouTube API on Python?

Why do I need a YouTube API? I have a quota on the max videos upload and I can set a private mod automatically.

CLIENT_SECRET_FILE = ('client_secret.json')
API_NAME = 'youtube'
API_VERSION = 'v3'
SCOPES = ['https://www.googleapis.com/auth/youtube.upload']

service = Create_Service(CLIENT_SECRET_FILE, API_NAME, API_VERSION, SCOPES)

WORDS = ("satisfying","satisfying video","the most satisfying","most oddly satisfying","satisfying videos","the most satisfying video in the world","oddly satisfying videos","sand and slime","ASMR vertical","best oddly satisfying","best oddly satisfying video","satisfying video for sleep","oddly satisfying video to help you sleep","stress relief,satisfaction","no music satisfying","slime","satisfying video to make you sleep","original resource","funny videos")
name = random.choice(WORDS)

WORDS = ("satisfying","satisfying video","the most satisfying","most oddly satisfying","satisfying videos","the most satisfying video in the world","oddly satisfying videos","sand and slime","ASMR vertical","best oddly satisfying","best oddly satisfying video","satisfying video for sleep","oddly satisfying video to help you sleep","stress relief,satisfaction","no music satisfying","slime","satisfying video to make you sleep","original resource","funny videos")
name2 = random.choice(WORDS)

title = (name+"|"+name2+"|"+"#Shorts")

list = []

os.chdir(r"C:\Users\Lukas\Desktop\auto youtube channel")
for file in glob.glob("*.mp4"):
    
    
    list.append(file)
    
    

temp = sum(isinstance(v, str) for v in list)
temp -= 2
    
while True:
    temps =0
    request_body = {
        'snippet': {
            'categoryI': 19,
            'title': title ,
            'description': '#Shorts                                                                                                                                shorts,satisfying,satisfying video,the most satisfying,most oddly satisfying,satisfying videos,the most satisfying video in the world,oddly satisfying videos,sand and slime,ASMR,best oddly satisfying,best oddly satisfying video,satisfying video for sleep,oddly satisfying video to help you sleep,stress relief,satisfaction,no music satisfying,slime,satisfying video to make you sleep,original resource,#shorts,try not to laugh,funny videos 2021',
            'tags': ["satisfying","satisfying video","the most satisfying","most oddly satisfying","satisfying videos","the most satisfying video in the world","oddly satisfying videos","sand and slime","ASMR vertical","best oddly satisfying","best oddly satisfying video","satisfying video for sleep","oddly satisfying video to help you sleep","stress relief,satisfaction","no music satisfying","slime","satisfying video to make you sleep","original resource","funny videos"]
        },
        'status': {
            'privacyStatus': 'private',
                
            'selfDeclaredMadeForKids': False, 
        },
        'notifySubscribers': False
    }

    mediaFile = MediaFileUpload("output"+ f'{temps:03}' +".mp4")

    response_upload = service.videos().insert(
        part='snippet,status',
        body=request_body,
        media_body=mediaFile
    ).execute()
    temps +=1
    
    if temps == 2:
        break

Here is my code to upload videos and youtube and create title nut it is not working.How to Get Started with Your First Automation Script Using the Youtube API

This tutorial will show you how to get started with your first automation script using the Youtube API.

Automation scripts are a lot of fun to make and can be very useful in everyday life. For example, if you want to learn the names of your favorite bands, but you don't have time to search for their names yourself each time, then an automation script can do that for you!

and here is my error with the quote and I do not know how to solute it.

Traceback (most recent call last): File "c:/Users/Lukas/Desktop/auto youtube channel/auto youtube channel .py", line 157, in response_upload = service.videos().insert( File "C:\Users\Lukas\AppData\Local\Programs\Python\Python38\lib\site-packages\googleapiclient_helpers.py", line 131, in positional_wrapper return wrapped(*args, **kwargs) File "C:\Users\Lukas\AppData\Local\Programs\Python\Python38\lib\site-packages\googleapiclient\http.py", line 937, in execute raise HttpError(resp, content, uri=self.uri) googleapiclient.errors.HttpError: <HttpError 403 when requesting https://youtube.googleapis.com/upload/youtube/v3/videos?part=snippet%2Cstatus&alt=json&uploadType=multipart returned "The request cannot be completed because you have exceeded your quota.". Details: "[{'message': 'The request cannot be completed because you have exceeded your quota.', 'domain': 'youtube.quota', 'reason': 'quotaExceeded'}]">

Upvotes: 2

Views: 2064

Answers (1)

jmrenouard
jmrenouard

Reputation: 104

I think you miss a thing on this question

You just touch max upload quota per day

For more information about Youtube API quotas https://developers.google.com/youtube/v3/determine_quota_cost

One of the most obvious think to do is waiting at least a day

Upvotes: 0

Related Questions