1

I get no error codes; everything seems to be validating correctly etc but simply nothing is happening on the YouTube channel. I have exceeded my limit rate so something has to be happening, but nothing that i can actually see. My code as follows

import os
import pickle
from google_auth_oauthlib.flow import InstalledAppFlow
from google.auth.transport.requests import Request
from googleapiclient.discovery import build

credentials = None #sets credentials to none

if os.path.exists('token.pickle'): #checks for our pickle file and opens it if it exists
    print('loading credentials from file...')
    with open('token.pickle', 'rb') as token: #rb opens byte file
        credentials = pickle.load(token) #loads our information(token) from pickle
#validates the credentials, if none are found makes and finds the credentials
if not credentials or not credentials.valid:
    if credentials and credentials.expired and credentials.refresh_token:
        print('refreshing access token...')
        credentials.refresh(Request())
    else:
        print('fetching new tokens...')
        flow = InstalledAppFlow.from_client_secrets_file('client_secrets.json', scopes=['https://www.googleapis.com/auth/youtube.force-ssl', 'https://www.googleapis.com/auth/youtube'])
        flow.run_local_server(port=8080, prompt='consent', authorization_prompt_message='')
        credentials = flow.credentials

        #saves credentials for next run
        with open('token.pickle', 'wb') as f:
            print("saving credentials for future use...")
            pickle.dump(credentials, f)

#builds youtube and validates our credentials
youtube = build('youtube', "v3", credentials=credentials)
playlist_name = str(input('name of playlist: '))

#makes the playlist
requests = youtube.playlists().insert(
        part="snippet,status",
        body={
          "snippet": {
            "title": playlist_name,
            "description": "This is a sample playlist description.",
            "tags": [
              "sample playlist",
              "API call"
            ],
            "defaultLanguage": "en"
          },
          "status": {
            "privacyStatus": "public"
          }
        }
        )


response = requests.execute()

print(response)
  • [This answer](https://stackoverflow.com/a/71970181/7123660) may interest you. – Benjamin Loison Sep 15 '22 at 20:02
  • Are you sure that you wanted to say *have* and not *haven't* in: *I have exceeded my limit rate so something has to be happening*? – Benjamin Loison Sep 15 '22 at 20:03
  • Do you have an error message how do you know you exacted your limit? Mind going to google cloud console and taking a screen shot of your current quota. – Linda Lawton - DaImTo Sep 15 '22 at 20:15
  • When i run the program now instead of nothing happening I just get HttpError 429 when requesting https://youtube.googleapis.com/youtube/v3/playlists?part=snippet%2Cstatus&alt=json returned "Resource has been exhausted (e.g. check quota).". Details: "[{'domain': 'youtube.api.v3.PlaylistInsertResponse.Error', 'reason': 'RATE_LIMIT_EXCEEDED'}]">. https://prnt.sc/pPaMts3_tCpZ < theres the screenshot for the quotas. – jacobr10183 Sep 15 '22 at 20:35
  • Im not too worried about dealing with the limit rate right now, I was testing lots of different things to try and create a playlist but nothing was working. I'm more concerned with getting the playlist to appear on youtube – jacobr10183 Sep 15 '22 at 20:45
  • so any idea on why a playlist isnt being added to my channel? – jacobr10183 Sep 18 '22 at 23:14

0 Answers0