Quantcast
Channel: Active questions tagged youtube-api - Stack Overflow
Viewing all articles
Browse latest Browse all 3831

youtube API not creating a playlist

$
0
0

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 osimport picklefrom google_auth_oauthlib.flow import InstalledAppFlowfrom google.auth.transport.requests import Requestfrom googleapiclient.discovery import buildcredentials = None #sets credentials to noneif 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 credentialsif 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 credentialsyoutube = build('youtube', "v3", credentials=credentials)playlist_name = str(input('name of playlist: '))#makes the playlistrequests = 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)

Viewing all articles
Browse latest Browse all 3831

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>