channel_id = 'UCa9gErQ9AE5jT2DZLjXBIdA' # my YouTube channel ID page_token = None # initialize page token url = 'https://www.googleapis.com/youtube/v3/search' # YouTube search API # extract video data across multiple search result pages video_id_list = [] while page_token != 0: params = { "key": my_key, 'channelId': channel_id, 'part': ["snippet","id"], 'order': "date", 'maxResults':50, 'pageToken': page_token } response = requests.get(url, params=params) for raw_item in dict(response.json())['items']: # only execute for youtube videos if raw_item['id']['kind'] != "youtube#video": continue # grab video ids video_id_list.append(raw_item['id']['videoId']) try: # grab next page token page_token = dict(response.json())['nextPageToken'] except: # if no next page token kill while loop page_token = 0