How can I grant my youtube api permissions to view my private , draft , unlisted videos. Currently its just able to view public videos. And also permissions to make changes to these videos and upload videos in python
I tried so many things maybe I am new so I am not able to find I am seeking for proper help.
And I am giving API access to the correct google account on which I have my youtube channel and some draft , private and unlisted videos
from google.oauth2.credentials import Credentialsfrom googleapiclient.discovery import buildfrom google.auth.transport.requests import Requestfrom google_auth_oauthlib.flow import InstalledAppFlowfrom googleapiclient.errors import HttpErrorimport datetimefrom datetime import timezone, timedeltaimport pytzimport google_auth_oauthlib.flowclientid = 'CLIENT_ID_HERE'# clientsecret= " CLIENT SECRET HERE "apikey= 'API KEY HERE'channelid = 'CHANNEL ID HERE'# Replace with your own API keyAPI_KEY = apikey# Replace with your own channel IDCHANNEL_ID = channelid# Authenticate the API clientscopes = ["https://www.googleapis.com/auth/youtube.readonly"]flow = google_auth_oauthlib.flow.InstalledAppFlow.from_client_secrets_file("youtube.json", scopes)credentials = flow.run_local_server(port=8080)youtube = build("youtube", "v3", credentials=credentials)# Set up the timezonetimezone = pytz.timezone("Asia/Kolkata") now = datetime.datetime.now(timezone)# Trying to get list of draft videos on your channelchannel_id = channelidrequest = youtube.search().list( part="id,snippet", q="channel:" + channel_id +" isDraft", type="video", fields="items(id(videoId),snippet(publishedAt,title,description))")response = request.execute()videos = response["items"]print(videos)# Schedule each video on an interval of 15 minutes from the current timefor i, video in enumerate(videos): video_id = video["id"]["videoId"] title = video["snippet"]["title"] description = video["snippet"]["description"] scheduled_time = now + timedelta(minutes=15 * (i + 1)) iso_time = scheduled_time.isoformat() # Update the video with the scheduled time request = youtube.videos().update( part="snippet,status", body={"id": video_id,"snippet": {"title": title,"description": description,"publishedAt": iso_time, },"status": {"privacyStatus": "private","publishAt": iso_time,"selfDeclaredMadeForKids": False, }, }, ) response = request.execute() print( f"Video '{title}' scheduled for {scheduled_time.strftime('%Y-%m-%d %H:%M:%S')} ({iso_time})")I am getting output as empty list