Python Split Variable Output to Multiple Variables
<p>First, I apologize for my ignorance here as I'm very new to Python and I may say things that really don't make sense.</p>

<p>I'm using the <code>youtube.search.list</code> API to create a variable <code>search_response</code>. This variable outputs the data on all searched videos in JSON format (I believe it's JSON anyways).</p>

<p>The search API is limited to 50 results per page but I've been able to use pagination to return up to 550 results (which is adequate for what I'm doing).</p>

<p>The <code>search.list</code> only provides me with details like the video title, date posted, video ID, etc. However, I'm hoping to access the view, like, and dislike counts for each video as well.</p>

<p>Using the <code>videos.list</code> API I have been able to pull in these variables (view, like, dislike) but it seems to be capped at 50 results as well and provides no pagination option.</p>

<p><a href="https://drive.google.com/open?id=0B-CXsNw4ZWO0Mm80clJqbDg3dkk" rel="nofollow">Here is a link</a> to the file in Jupyter Notebook (also attaching in .py).</p>

<p>So I'm thinking that if I can separate the JSON file (<code>search_response</code>) into segments of 50 posts I should be to run it 10 times and download views, likes, and dislikes for all videos. However, I have no idea how to separate the output of my <code>search_response</code> variable and appreciate any thoughts or suggestions on this!</p>

<p><strong>To summarize this issue:</strong></p>

<ul>
<li>I have a variable <code>search_response</code> outputting, in JSON format, hundreds of individual sections (one for each video)</li>
<li>The <code>videos.list</code> API to gather detailed stats (view, dis/like count) has a limit of 50 requests</li>
<li>I'm looking for a way to separate the <code>search_response</code> output into multiple variables of 50 sections each to run individually in the API</li>
</ul>

<p><strong>Code Used:</strong>
<em>Gather Data</em></p>

<pre><code>from apiclient.discovery import build
from apiclient.errors import HttpError
from oauth2client.tools import argparser

DEVELOPER_KEY = "REPLACE ME"
YOUTUBE_API_SERVICE_NAME = "youtube"
YOUTUBE_API_VERSION = "v3"

def fetch_all_youtube_videos(channelId):

youtube = build(YOUTUBE_API_SERVICE_NAME,
                YOUTUBE_API_VERSION,
                developerKey=DEVELOPER_KEY)
res = youtube.search().list(
q="",
part="id,snippet",
channelId=channelId,
maxResults=50,
).execute()

nextPageToken = res.get('nextPageToken')
while ('nextPageToken' in res):
    nextPage = youtube.search().list(
    part="id,snippet",
    channelId=channelId,
    maxResults="50",
    pageToken=nextPageToken
    ).execute()
    res['items'] = res['items'] + nextPage['items']

    if 'nextPageToken' not in nextPage:
        res.pop('nextPageToken', None)
    else:
        nextPageToken = nextPage['nextPageToken']

return res

if __name__ == '__main__':
search_response = fetch_all_youtube_videos("UCp0hYYBW6IMayGgR-WeoCvQ")

videos = []   

for search_result in search_response.get("items", []):
if search_result["id"]["kind"] == "youtube#video":
    videos.append("%s (%s)" % (search_result["snippet"]["title"],
                             search_result["id"]["videoId"]))
</code></pre>

<p><strong>Code Used:</strong>
<em>Add Detailed Stats</em></p>

<pre><code>youtube = build(YOUTUBE_API_SERVICE_NAME, YOUTUBE_API_VERSION, developerKey=DEVELOPER_KEY)

videos = {}

for search_result in search_response.get("items", []):
if search_result["id"]["kind"] == "youtube#video":
    videos[search_result["id"]["videoId"]] = search_result["snippet"]["title"]

video_ids_list = ','.join(videos.keys())

video_list_stats = youtube.videos().list(
 id=video_ids_list,
 part='id,statistics'
).execute()
</code></pre>

<p><strong>Ideal Output:</strong><em>This output corresponds to the first 50 etag sections (only have 25 or so displayed here because of character limits on this website but should be 50 sections) of the</em> <code>search_response</code> <em>variable and could be called</em> <code>search_response1</code> <em>where</em> <code>search_response2</code> <em>could encompass etag sections 51-100 and so on.</em></p>

<pre><code>    search_response1 = {'etag': '"I_8xdZu766_FSaexEaDXTIfEWc0/hsQmFEqp1R_glFpcQnpnOLbbxCg"',
   'id': {'kind': 'youtube#video', 'videoId': 'd8kCTPPwfpM'},
   'kind': 'youtube#searchResult',
   'snippet': {'channelId': 'UCp0hYYBW6IMayGgR-WeoCvQ',
    'channelTitle': 'TheEllenShow',
    'description': "This incredible duo teamed up to perform an original song for Ellen! They may not have had a lot of rehearsal, but it's clear that this is one musical combo it ...",
    'liveBroadcastContent': 'none',
    'publishedAt': '2012-02-21T14:00:00.000Z',
    'thumbnails': {'default': {'height': 90,
      'url': 'https://i.ytimg.com/vi/d8kCTPPwfpM/default.jpg',
      'width': 120},
     'high': {'height': 360,
      'url': 'https://i.ytimg.com/vi/d8kCTPPwfpM/hqdefault.jpg',
      'width': 480},
     'medium': {'height': 180,
      'url': 'https://i.ytimg.com/vi/d8kCTPPwfpM/mqdefault.jpg',
      'width': 320}},
    'title': 'Taylor Swift and Zac Efron Sing a Duet!'}},
  {'etag': '"I_8xdZu766_FSaexEaDXTIfEWc0/LeKypRrnWWD6mRhK1wATZB5UQGo"',
   'id': {'kind': 'youtube#video', 'videoId': '-l2KPjQ2lJA'},
   'kind': 'youtube#searchResult',
   'snippet': {'channelId': 'UCp0hYYBW6IMayGgR-WeoCvQ',
    'channelTitle': 'TheEllenShow',
    'description': "Harry, Liam, Louis and Niall played a round of Ellen's revealing game. How well do you know the guys of One Direction?",
    'liveBroadcastContent': 'none',
    'publishedAt': '2015-11-18T14:00:00.000Z',
    'thumbnails': {'default': {'height': 90,
      'url': 'https://i.ytimg.com/vi/-l2KPjQ2lJA/default.jpg',
      'width': 120},
     'high': {'height': 360,
      'url': 'https://i.ytimg.com/vi/-l2KPjQ2lJA/hqdefault.jpg',
      'width': 480},
     'medium': {'height': 180,
      'url': 'https://i.ytimg.com/vi/-l2KPjQ2lJA/mqdefault.jpg',
      'width': 320}},
    'title': 'Never Have I Ever with One Direction'}},
  {'etag': '"I_8xdZu766_FSaexEaDXTIfEWc0/qm7jX3gngQBYS7xv9sROxTpUtDU"',
   'id': {'kind': 'youtube#video', 'videoId': 'Jr7bRw0NxQ4'},
   'kind': 'youtube#searchResult',
   'snippet': {'channelId': 'UCp0hYYBW6IMayGgR-WeoCvQ',
    'channelTitle': 'TheEllenShow',
    'description': 'Ellen has always loved giving her guests a good thrill, and she put together this montage of some of her favorite scares from over the years!',
    'liveBroadcastContent': 'none',
    'publishedAt': '2015-11-19T14:00:00.000Z',
    'thumbnails': {'default': {'height': 90,
      'url': 'https://i.ytimg.com/vi/Jr7bRw0NxQ4/default.jpg',
      'width': 120},
     'high': {'height': 360,
      'url': 'https://i.ytimg.com/vi/Jr7bRw0NxQ4/hqdefault.jpg',
      'width': 480},
     'medium': {'height': 180,
      'url': 'https://i.ytimg.com/vi/Jr7bRw0NxQ4/mqdefault.jpg',
      'width': 320}},
    'title': "Ellen's Never-Ending Scares"}},
  {'etag': '"I_8xdZu766_FSaexEaDXTIfEWc0/dWDEID-z2CI4P-eh62pmTxWq0uc"',
   'id': {'kind': 'youtube#video', 'videoId': 't5jw3T3Jy70'},
   'kind': 'youtube#searchResult',
   'snippet': {'channelId': 'UCp0hYYBW6IMayGgR-WeoCvQ',
    'channelTitle': 'TheEllenShow',
    'description': "Kristen Bell loves sloths. You might even say she's obsessed with them. She told Ellen about what happened when her boyfriend, Dax Shepard, introduced her ...",
    'liveBroadcastContent': 'none',
    'publishedAt': '2012-01-31T03:18:55.000Z',
    'thumbnails': {'default': {'height': 90,
      'url': 'https://i.ytimg.com/vi/t5jw3T3Jy70/default.jpg',
      'width': 120},
     'high': {'height': 360,
      'url': 'https://i.ytimg.com/vi/t5jw3T3Jy70/hqdefault.jpg',
      'width': 480},
     'medium': {'height': 180,
      'url': 'https://i.ytimg.com/vi/t5jw3T3Jy70/mqdefault.jpg',
      'width': 320}},
    'title': "Kristen Bell's Sloth Meltdown"}},
  {'etag': '"I_8xdZu766_FSaexEaDXTIfEWc0/ZSOfmz-dGZ3R0LNJ2n1LLQ4hEjg"',
   'id': {'kind': 'youtube#video', 'videoId': 'fC_Z5HlK9Pw'},
   'kind': 'youtube#searchResult',
   'snippet': {'channelId': 'UCp0hYYBW6IMayGgR-WeoCvQ',
    'channelTitle': 'TheEllenShow',
    'description': "The two incredibly handsome and talented stars got hilariously honest while playing one of Ellen's favorite games.",
    'liveBroadcastContent': 'none',
    'publishedAt': '2016-05-18T13:00:04.000Z',
    'thumbnails': {'default': {'height': 90,
      'url': 'https://i.ytimg.com/vi/fC_Z5HlK9Pw/default.jpg',
      'width': 120},
     'high': {'height': 360,
      'url': 'https://i.ytimg.com/vi/fC_Z5HlK9Pw/hqdefault.jpg',
      'width': 480},
     'medium': {'height': 180,
      'url': 'https://i.ytimg.com/vi/fC_Z5HlK9Pw/mqdefault.jpg',
      'width': 320}},
    'title': 'Drake and Jared Leto Play Never Have\xa0I\xa0Ever'}},
  {'etag': '"I_8xdZu766_FSaexEaDXTIfEWc0/M9siwkGRaHrf5ELg2R1JceH2KmA"',
   'id': {'kind': 'youtube#video', 'videoId': '4aKteL3vMvU'},
   'kind': 'youtube#searchResult',
   'snippet': {'channelId': 'UCp0hYYBW6IMayGgR-WeoCvQ',
    'channelTitle': 'TheEllenShow',
    'description': 'The amazing Adele belted out her hit song for the first time since her Grammy performance.',
    'liveBroadcastContent': 'none',
    'publishedAt': '2016-02-18T14:00:00.000Z',
    'thumbnails': {'default': {'height': 90,
      'url': 'https://i.ytimg.com/vi/4aKteL3vMvU/default.jpg',
      'width': 120},
     'high': {'height': 360,
      'url': 'https://i.ytimg.com/vi/4aKteL3vMvU/hqdefault.jpg',
      'width': 480},
     'medium': {'height': 180,
      'url': 'https://i.ytimg.com/vi/4aKteL3vMvU/mqdefault.jpg',
      'width': 320}},
    'title': "Adele Performs\xa0'All\xa0I\xa0Ask'"}},
  {'etag': '"I_8xdZu766_FSaexEaDXTIfEWc0/od24uJeVxDWErhRWWtsSKHuD9oQ"',
   'id': {'kind': 'youtube#video', 'videoId': 'WOgKIlvjlQ8'},
   'kind': 'youtube#searchResult',
   'snippet': {'channelId': 'UCp0hYYBW6IMayGgR-WeoCvQ',
    'channelTitle': 'TheEllenShow',
    'description': 'Ellen, Johnny Depp, Gwyneth Paltrow and Paul Bettany all played an incredibly revealing round of "Never Have I Ever." You won\'t believe what they revealed!',
    'liveBroadcastContent': 'none',
    'publishedAt': '2015-01-23T14:00:13.000Z',
    'thumbnails': {'default': {'height': 90,
      'url': 'https://i.ytimg.com/vi/WOgKIlvjlQ8/default.jpg',
      'width': 120},
     'high': {'height': 360,
      'url': 'https://i.ytimg.com/vi/WOgKIlvjlQ8/hqdefault.jpg',
      'width': 480},
     'medium': {'height': 180,
      'url': 'https://i.ytimg.com/vi/WOgKIlvjlQ8/mqdefault.jpg',
      'width': 320}},
    'title': 'Never Have I Ever'}},
  {'etag': '"I_8xdZu766_FSaexEaDXTIfEWc0/Wu5vxAyQ5QGl6uO7eIodYHjaqVI"',
   'id': {'kind': 'youtube#video', 'videoId': '07nXzFPHiGU'},
   'kind': 'youtube#searchResult',
   'snippet': {'channelId': 'UCp0hYYBW6IMayGgR-WeoCvQ',
    'channelTitle': 'TheEllenShow',
    'description': "The two music icons played a revealing game with Ellen. You won't believe their responses.",
    'liveBroadcastContent': 'none',
    'publishedAt': '2015-03-19T13:00:00.000Z',
    'thumbnails': {'default': {'height': 90,
      'url': 'https://i.ytimg.com/vi/07nXzFPHiGU/default.jpg',
      'width': 120},
     'high': {'height': 360,
      'url': 'https://i.ytimg.com/vi/07nXzFPHiGU/hqdefault.jpg',
      'width': 480},
     'medium': {'height': 180,
      'url': 'https://i.ytimg.com/vi/07nXzFPHiGU/mqdefault.jpg',
      'width': 320}},
    'title': 'Never Have I Ever with Madonna and Justin Bieber'}},
  {'etag': '"I_8xdZu766_FSaexEaDXTIfEWc0/Z8HWp7YAzQPWcodFthhbxOU3l2U"',
   'id': {'kind': 'youtube#video', 'videoId': 'Wh8m4PYlSGY'},
   'kind': 'youtube#searchResult',
   'snippet': {'channelId': 'UCp0hYYBW6IMayGgR-WeoCvQ',
    'channelTitle': 'TheEllenShow',
    'description': 'Ellen challenged Jennifer Lopez to a round of her fun and revealing game.',
    'liveBroadcastContent': 'none',
    'publishedAt': '2015-05-18T19:00:01.000Z',
    'thumbnails': {'default': {'height': 90,
      'url': 'https://i.ytimg.com/vi/Wh8m4PYlSGY/default.jpg',
      'width': 120},
     'high': {'height': 360,
      'url': 'https://i.ytimg.com/vi/Wh8m4PYlSGY/hqdefault.jpg',
      'width': 480},
     'medium': {'height': 180,
      'url': 'https://i.ytimg.com/vi/Wh8m4PYlSGY/mqdefault.jpg',
      'width': 320}},
    'title': 'J.Lo and Ellen Play Never Have I Ever'}},
  {'etag': '"I_8xdZu766_FSaexEaDXTIfEWc0/3B4UvmeCI4Y9UZC2f6kF09wpmW8"',
   'id': {'kind': 'youtube#video', 'videoId': 'QJY5VVQsFZ0'},
   'kind': 'youtube#searchResult',
   'snippet': {'channelId': 'UCp0hYYBW6IMayGgR-WeoCvQ',
    'channelTitle': 'TheEllenShow',
    'description': 'Adele sure can sing, but can she beat the clock? Watch what happened when Ellen challenged her to a game of 5 Second Rule!',
    'liveBroadcastContent': 'none',
    'publishedAt': '2016-02-24T14:00:01.000Z',
    'thumbnails': {'default': {'height': 90,
      'url': 'https://i.ytimg.com/vi/QJY5VVQsFZ0/default.jpg',
      'width': 120},
     'high': {'height': 360,
      'url': 'https://i.ytimg.com/vi/QJY5VVQsFZ0/hqdefault.jpg',
      'width': 480},
     'medium': {'height': 180,
      'url': 'https://i.ytimg.com/vi/QJY5VVQsFZ0/mqdefault.jpg',
      'width': 320}},
    'title': '5 Second Rule with Adele'}},
  {'etag': '"I_8xdZu766_FSaexEaDXTIfEWc0/mYDa0rUVIvzHCbQfJGRq2VeZ2so"',
   'id': {'kind': 'youtube#video', 'videoId': 'vEVrYx8-lys'},
   'kind': 'youtube#searchResult',
   'snippet': {'channelId': 'UCp0hYYBW6IMayGgR-WeoCvQ',
    'channelTitle': 'TheEllenShow',
    'description': '"Brave" may be the wrong word, but Ellen\'s Executive Producer, Andy Lassner, and his assistant, Jacqueline, made their way through a haunted house.',
    'liveBroadcastContent': 'none',
    'publishedAt': '2014-10-31T16:50:33.000Z',
    'thumbnails': {'default': {'height': 90,
      'url': 'https://i.ytimg.com/vi/vEVrYx8-lys/default.jpg',
      'width': 120},
     'high': {'height': 360,
      'url': 'https://i.ytimg.com/vi/vEVrYx8-lys/hqdefault.jpg',
      'width': 480},
     'medium': {'height': 180,
      'url': 'https://i.ytimg.com/vi/vEVrYx8-lys/mqdefault.jpg',
      'width': 320}},
    'title': 'Andy and Jacqueline Brave the Haunted House'}},
  {'etag': '"I_8xdZu766_FSaexEaDXTIfEWc0/kprvuH9aAXC-dIAlXMbwA3Klp14"',
   'id': {'kind': 'youtube#video', 'videoId': 'wTAJSuhgZxA'},
   'kind': 'youtube#searchResult',
   'snippet': {'channelId': 'UCp0hYYBW6IMayGgR-WeoCvQ',
    'channelTitle': 'TheEllenShow',
    'description': "Adele's new single is a hit, thanks to a chat she had with Ellenâ¦",
    'liveBroadcastContent': 'none',
    'publishedAt': '2015-10-29T13:00:01.000Z',
    'thumbnails': {'default': {'height': 90,
      'url': 'https://i.ytimg.com/vi/wTAJSuhgZxA/default.jpg',
      'width': 120},
     'high': {'height': 360,
      'url': 'https://i.ytimg.com/vi/wTAJSuhgZxA/hqdefault.jpg',
      'width': 480},
     'medium': {'height': 180,
      'url': 'https://i.ytimg.com/vi/wTAJSuhgZxA/mqdefault.jpg',
      'width': 320}},
    'title': "Ellen Inspired Adele's New Song"}},
  {'etag': '"I_8xdZu766_FSaexEaDXTIfEWc0/Ge10B_3x9KSfQTWF5V-ZNHDuqwU"',
   'id': {'kind': 'youtube#video', 'videoId': 'oJsYwehp_r4'},
   'kind': 'youtube#searchResult',
   'snippet': {'channelId': 'UCp0hYYBW6IMayGgR-WeoCvQ',
    'channelTitle': 'TheEllenShow',
    'description': 'She loves to scare her guests. Take a look at a few of these recent favorites!',
    'liveBroadcastContent': 'none',
    'publishedAt': '2015-05-27T13:00:01.000Z',
    'thumbnails': {'default': {'height': 90,
      'url': 'https://i.ytimg.com/vi/oJsYwehp_r4/default.jpg',
      'width': 120},
     'high': {'height': 360,
      'url': 'https://i.ytimg.com/vi/oJsYwehp_r4/hqdefault.jpg',
      'width': 480},
     'medium': {'height': 180,
      'url': 'https://i.ytimg.com/vi/oJsYwehp_r4/mqdefault.jpg',
      'width': 320}},
    'title': "Ellen's Favorite Scares"}},
  {'etag': '"I_8xdZu766_FSaexEaDXTIfEWc0/Em-6euVf5saohkrtNZzXR2jmaTo"',
   'id': {'kind': 'youtube#video', 'videoId': 'Vap9SMRf8YE'},
   'kind': 'youtube#searchResult',
   'snippet': {'channelId': 'UCp0hYYBW6IMayGgR-WeoCvQ',
    'channelTitle': 'TheEllenShow',
    'description': "Ellen and Sofia played a hilarious game of 5 Second Rule! Check it out, plus all the fun we didn't have time for in the show!",
    'liveBroadcastContent': 'none',
    'publishedAt': '2015-12-03T14:00:01.000Z',
    'thumbnails': {'default': {'height': 90,
      'url': 'https://i.ytimg.com/vi/Vap9SMRf8YE/default.jpg',
      'width': 120},
     'high': {'height': 360,
      'url': 'https://i.ytimg.com/vi/Vap9SMRf8YE/hqdefault.jpg',
      'width': 480},
     'medium': {'height': 180,
      'url': 'https://i.ytimg.com/vi/Vap9SMRf8YE/mqdefault.jpg',
      'width': 320}},
    'title': '5 Second Rule with Sofia Vergara -- Extended!'}},
  {'etag': '"I_8xdZu766_FSaexEaDXTIfEWc0/o7GMiOOo84bHhNwHGc6qQZ1ebRc"',
   'id': {'kind': 'youtube#video', 'videoId': 'ZXZ6K21wvZM'},
   'kind': 'youtube#searchResult',
   'snippet': {'channelId': 'UCp0hYYBW6IMayGgR-WeoCvQ',
    'channelTitle': 'TheEllenShow',
    'description': "Ellen's writer Amy scares pretty easily, but she's nothing compared to Ellen's Executive Producer, Andy. That's why he was the perfect person to join Amy in this ...",
    'liveBroadcastContent': 'none',
    'publishedAt': '2013-10-22T13:00:05.000Z',
    'thumbnails': {'default': {'height': 90,
      'url': 'https://i.ytimg.com/vi/ZXZ6K21wvZM/default.jpg',
      'width': 120},
     'high': {'height': 360,
      'url': 'https://i.ytimg.com/vi/ZXZ6K21wvZM/hqdefault.jpg',
      'width': 480},
     'medium': {'height': 180,
      'url': 'https://i.ytimg.com/vi/ZXZ6K21wvZM/mqdefault.jpg',
      'width': 320}},
    'title': "Andy and Amy's Haunted House"}},
  {'etag': '"I_8xdZu766_FSaexEaDXTIfEWc0/SyuA5bIoXdtQD_0SQUu1PyfvPP4"',
   'id': {'kind': 'youtube#video', 'videoId': 'QrIrbeoDkT0'},
   'kind': 'youtube#searchResult',
   'snippet': {'channelId': 'UCp0hYYBW6IMayGgR-WeoCvQ',
    'channelTitle': 'TheEllenShow',
    'description': "Ellen met Noah Ritter after a video of him went viral. Nobody could have predicted what she was in for. Ellen Meets the 'Apparently' Kid, Part 2 ...",
    'liveBroadcastContent': 'none',
    'publishedAt': '2014-09-11T18:37:28.000Z',
    'thumbnails': {'default': {'height': 90,
      'url': 'https://i.ytimg.com/vi/QrIrbeoDkT0/default.jpg',
      'width': 120},
     'high': {'height': 360,
      'url': 'https://i.ytimg.com/vi/QrIrbeoDkT0/hqdefault.jpg',
      'width': 480},
     'medium': {'height': 180,
      'url': 'https://i.ytimg.com/vi/QrIrbeoDkT0/mqdefault.jpg',
      'width': 320}},
    'title': 'Ellen Meets the âApparentlyâ Kid, Part 1'}},
  {'etag': '"I_8xdZu766_FSaexEaDXTIfEWc0/Ag0Zp0Gg9tiWeBYr4k1p5W7EnLI"',
   'id': {'kind': 'youtube#video', 'videoId': 'U8Gv83xiFP8'},
   'kind': 'youtube#searchResult',
   'snippet': {'channelId': 'UCp0hYYBW6IMayGgR-WeoCvQ',
    'channelTitle': 'TheEllenShow',
    'description': 'Emma Stone, Jamie Foxx and Andrew Garfield all participated in a revealing round of the saucy question and answer game.',
    'liveBroadcastContent': 'none',
    'publishedAt': '2014-04-04T04:55:12.000Z',
    'thumbnails': {'default': {'height': 90,
      'url': 'https://i.ytimg.com/vi/U8Gv83xiFP8/default.jpg',
      'width': 120},
     'high': {'height': 360,
      'url': 'https://i.ytimg.com/vi/U8Gv83xiFP8/hqdefault.jpg',
      'width': 480},
     'medium': {'height': 180,
      'url': 'https://i.ytimg.com/vi/U8Gv83xiFP8/mqdefault.jpg',
      'width': 320}},
    'title': "'The Amazing Spider-Man 2' Cast Plays Never Have I Ever"}},
  {'etag': '"I_8xdZu766_FSaexEaDXTIfEWc0/EeSV1P1pL1VAVWYm27ev8YIWcTk"',
   'id': {'kind': 'youtube#video', 'videoId': 'QyJ8rulYHpU'},
   'kind': 'youtube#searchResult',
   'snippet': {'channelId': 'UCp0hYYBW6IMayGgR-WeoCvQ',
    'channelTitle': 'TheEllenShow',
    'description': "Ellen had a star turn in Nicki's viral video. What did Nicki think? Find out!",
    'liveBroadcastContent': 'none',
    'publishedAt': '2014-09-10T05:38:21.000Z',
    'thumbnails': {'default': {'height': 90,
      'url': 'https://i.ytimg.com/vi/QyJ8rulYHpU/default.jpg',
      'width': 120},
     'high': {'height': 360,
      'url': 'https://i.ytimg.com/vi/QyJ8rulYHpU/hqdefault.jpg',
      'width': 480},
     'medium': {'height': 180,
      'url': 'https://i.ytimg.com/vi/QyJ8rulYHpU/mqdefault.jpg',
      'width': 320}},
    'title': 'Nicki Minaj Reacts to Ellenâs âAnacondaâ'}},
  {'etag': '"I_8xdZu766_FSaexEaDXTIfEWc0/lklEBOJbEqTsZhzFeWQDvaEaovo"',
   'id': {'kind': 'youtube#video', 'videoId': '7nGz7xgGJzc'},
   'kind': 'youtube#searchResult',
   'snippet': {'channelId': 'UCp0hYYBW6IMayGgR-WeoCvQ',
    'channelTitle': 'TheEllenShow',
    'description': "After Ellen saw Brielle's video on ellentube, she invited her to showcase her science smarts on the show!",
    'liveBroadcastContent': 'none',
    'publishedAt': '2015-11-23T14:00:01.000Z',
    'thumbnails': {'default': {'height': 90,
      'url': 'https://i.ytimg.com/vi/7nGz7xgGJzc/default.jpg',
      'width': 120},
     'high': {'height': 360,
      'url': 'https://i.ytimg.com/vi/7nGz7xgGJzc/hqdefault.jpg',
      'width': 480},
     'medium': {'height': 180,
      'url': 'https://i.ytimg.com/vi/7nGz7xgGJzc/mqdefault.jpg',
      'width': 320}},
    'title': 'Adorable 3-Year-Old Periodic Table Expert Brielle'}},
  {'etag': '"I_8xdZu766_FSaexEaDXTIfEWc0/lFfDdAriFOK6-7T-GqAaQrfZrL0"',
   'id': {'kind': 'youtube#video', 'videoId': '2DYfLJrp1TQ'},
   'kind': 'youtube#searchResult',
   'snippet': {'channelId': 'UCp0hYYBW6IMayGgR-WeoCvQ',
    'channelTitle': 'TheEllenShow',
    'description': 'Ellen loves scaring her executive producer, Andy Lassner, and "Modern Family" star Eric Stonestreet. So, of course she couldn\'t wait to send them both through ...',
    'liveBroadcastContent': 'none',
    'publishedAt': '2015-10-29T13:00:00.000Z',
    'thumbnails': {'default': {'height': 90,
      'url': 'https://i.ytimg.com/vi/2DYfLJrp1TQ/default.jpg',
      'width': 120},
     'high': {'height': 360,
      'url': 'https://i.ytimg.com/vi/2DYfLJrp1TQ/hqdefault.jpg',
      'width': 480},
     'medium': {'height': 180,
      'url': 'https://i.ytimg.com/vi/2DYfLJrp1TQ/mqdefault.jpg',
      'width': 320}},
    'title': 'Andy Goes to a Haunted House with Eric Stonestreet'}},
  {'etag': '"I_8xdZu766_FSaexEaDXTIfEWc0/UPK4p6u7VdWPSkW1Cnz5QKCxfXk"',
   'id': {'kind': 'youtube#video', 'videoId': 'fNJI2A0v8yI'},
   'kind': 'youtube#searchResult',
   'snippet': {'channelId': 'UCp0hYYBW6IMayGgR-WeoCvQ',
    'channelTitle': 'TheEllenShow',
    'description': 'Leonardo DiCaprio is quite the daredevil, and he told Ellen about a few of his close calls!',
    'liveBroadcastContent': 'none',
    'publishedAt': '2016-01-08T14:00:01.000Z',
    'thumbnails': {'default': {'height': 90,
      'url': 'https://i.ytimg.com/vi/fNJI2A0v8yI/default.jpg',
      'width': 120},
     'high': {'height': 360,
      'url': 'https://i.ytimg.com/vi/fNJI2A0v8yI/hqdefault.jpg',
      'width': 480},
     'medium': {'height': 180,
      'url': 'https://i.ytimg.com/vi/fNJI2A0v8yI/mqdefault.jpg',
      'width': 320}},
    'title': "Leo's Bad Luck"}},
  {'etag': '"I_8xdZu766_FSaexEaDXTIfEWc0/cdwuhXK78q9_SFeRcIdz2ZKxvy4"',
   'id': {'kind': 'youtube#video', 'videoId': '3RLTanW1DGo'},
   'kind': 'youtube#searchResult',
   'snippet': {'channelId': 'UCp0hYYBW6IMayGgR-WeoCvQ',
    'channelTitle': 'TheEllenShow',
    'description': 'Their visit to the haunted house was so funny, Ellen had to send them again! This time Andy and Amy visited the Queen Mary Dark Harbor, and the results ...',
    'liveBroadcastContent': 'none',
    'publishedAt': '2013-10-31T13:00:03.000Z',
    'thumbnails': {'default': {'height': 90,
      'url': 'https://i.ytimg.com/vi/3RLTanW1DGo/default.jpg',
      'width': 120},
     'high': {'height': 360,
      'url': 'https://i.ytimg.com/vi/3RLTanW1DGo/hqdefault.jpg',
      'width': 480},
     'medium': {'height': 180,
      'url': 'https://i.ytimg.com/vi/3RLTanW1DGo/mqdefault.jpg',
      'width': 320}},
    'title': "Andy and Amy's Haunted Ship Adventure"}},
  {'etag': '"I_8xdZu766_FSaexEaDXTIfEWc0/N1j-mxkND6apYO8kdjitbd3mOns"',
   'id': {'kind': 'youtube#video', 'videoId': 'zcAQCTZ3TuQ'},
   'kind': 'youtube#searchResult',
   'snippet': {'channelId': 'UCp0hYYBW6IMayGgR-WeoCvQ',
    'channelTitle': 'TheEllenShow',
    'description': "Ellen held nothing back when when Mila Kunis was here, and asked her about what's going on between her and Ashton Kutcher. See how she responded!",
    'liveBroadcastContent': 'none',
    'publishedAt': '2013-02-13T17:14:14.000Z',
    'thumbnails': {'default': {'height': 90,
      'url': 'https://i.ytimg.com/vi/zcAQCTZ3TuQ/default.jpg',
      'width': 120},
     'high': {'height': 360,
      'url': 'https://i.ytimg.com/vi/zcAQCTZ3TuQ/hqdefault.jpg',
      'width': 480},
     'medium': {'height': 180,
      'url': 'https://i.ytimg.com/vi/zcAQCTZ3TuQ/mqdefault.jpg',
      'width': 320}},
    'title': 'Mila Kunis Blushes over Ashton'}},
  {'etag': '"I_8xdZu766_FSaexEaDXTIfEWc0/b7ZtfnV8spHzXmzgj_c0lN2dwJ0"',
   'id': {'kind': 'youtube#video', 'videoId': 'pP-PF4nKb0I'},
   'kind': 'youtube#searchResult',
   'snippet': {'channelId': 'UCp0hYYBW6IMayGgR-WeoCvQ',
    'channelTitle': 'TheEllenShow',
    'description': 'It was a legendary meeting on The Ellen Show, Sophia Grace &amp; Rosie and Russell Brand met for the very first time to discuss their hometown of Essex, England ...',
    'liveBroadcastContent': 'none',
    'publishedAt': '2012-05-17T02:57:04.000Z',
    'thumbnails': {'default': {'height': 90,
      'url': 'https://i.ytimg.com/vi/pP-PF4nKb0I/default.jpg',
      'width': 120},
     'high': {'height': 360,
      'url': 'https://i.ytimg.com/vi/pP-PF4nKb0I/hqdefault.jpg',
      'width': 480},
     'medium': {'height': 180,
      'url': 'https://i.ytimg.com/vi/pP-PF4nKb0I/mqdefault.jpg',
      'width': 320}},
    'title': 'Sophia Grace &amp; Rosie Meet Russell Brand'}},
  {'etag': '"I_8xdZu766_FSaexEaDXTIfEWc0/U3UJ8UFIu4nRHqfysq91oHzinuw"',
   'id': {'kind': 'youtube#video', 'videoId': 'mUr5KxtKZQk'},
   'kind': 'youtube#searchResult',
   'snippet': {'channelId': 'UCp0hYYBW6IMayGgR-WeoCvQ',
    'channelTitle': 'TheEllenShow',
    'description': 'After chatting with Sofia Vergara, Ellen sent her into a store on the WB lot for some hidden camera fun!',
    'liveBroadcastContent': 'none',
    'publishedAt': '2010-11-03T19:13:20.000Z',
    'thumbnails': {'default': {'height': 90,
      'url': 'https://i.ytimg.com/vi/mUr5KxtKZQk/default.jpg',
      'width': 120},
     'high': {'height': 360,
      'url': 'https://i.ytimg.com/vi/mUr5KxtKZQk/hqdefault.jpg',
      'width': 480},
     'medium': {'height': 180,
      'url': 'https://i.ytimg.com/vi/mUr5KxtKZQk/mqdefault.jpg',
      'width': 320}},
    'title': 'Sofia Vergara Plays a Hidden Camera Prank'}},
  {'etag': '"I_8xdZu766_FSaexEaDXTIfEWc0/B4kmiOv8FEBHoH3MRiahPrDEGxc"',
   'id': {'kind': 'youtube#video', 'videoId': '5SZ_--mt4bk'},
   'kind': 'youtube#searchResult',
   'snippet': {'channelId': 'UCp0hYYBW6IMayGgR-WeoCvQ',
    'channelTitle': 'TheEllenShow',
    'description': 'They were staked out in the bathroom for this hilarious round of scares!',
    'liveBroadcastContent': 'none',
    'publishedAt': '2015-02-06T14:00:01.000Z',
    'thumbnails': {'default': {'height': 90,
      'url': 'https://i.ytimg.com/vi/5SZ_--mt4bk/default.jpg',
      'width': 120},
     'high': {'height': 360,
      'url': 'https://i.ytimg.com/vi/5SZ_--mt4bk/hqdefault.jpg',
      'width': 480},
     'medium': {'height': 180,
      'url': 'https://i.ytimg.com/vi/5SZ_--mt4bk/mqdefault.jpg',
      'width': 320}},
    'title': 'Justin Bieber and Ellen Scare Audience Members'}},
</code></pre>

<p>Thank you.</p>

<p>Given the Jupyter notebook you referenced here's how you'd get the videoId from the data you've retrieved. Does this answer your question? </p>

<p>I'm not fully sure how the Youtube search API works but I might have time to explore it if this isn't a full answer.</p>

<pre><code>example = {
    'etag': '"I_8xdZu766_FSaexEaDXTIfEWc0/EK5D70JgnA5Bec8tRSnEFfhIsv0"',
    'items': [
        {
            'etag': '"I_8xdZu766_FSaexEaDXTIfEWc0/hsQmFEqp1R_glFpcQnpnOLbbxCg"',
            'id': {
                'kind': 'youtube#video', 'videoId': 'd8kCTPPwfpM'},
            'kind': 'youtube#searchResult',
            'snippet': {
                'channelId': 'UCp0hYYBW6IMayGgR-WeoCvQ',
                'channelTitle': 'TheEllenShow',
            'description': "This incredible duo teamed up to perform an original song for Ellen! They may not have had a lot of rehearsal, but it's clear that this is one musical combo it ...",
            'liveBroadcastContent': 'none',
            'publishedAt': '2012-02-21T14:00:00.000Z',
    'thumbnails': {'default': {'height': 90,
      'url': 'https://i.ytimg.com/vi/d8kCTPPwfpM/default.jpg',
      'width': 120},
     'high': {'height': 360,
      'url': 'https://i.ytimg.com/vi/d8kCTPPwfpM/hqdefault.jpg',
      'width': 480},
     'medium': {'height': 180,
      'url': 'https://i.ytimg.com/vi/d8kCTPPwfpM/mqdefault.jpg',
      'width': 320}},
    'title': 'Taylor Swift and Zac Efron Sing a Duet!'}},
  {'etag': '"I_8xdZu766_FSaexEaDXTIfEWc0/LeKypRrnWWD6mRhK1wATZB5UQGo"',
   'id': {'kind': 'youtube#video', 'videoId': '-l2KPjQ2lJA'},
   'kind': 'youtube#searchResult',
   'snippet': {'channelId': 'UCp0hYYBW6IMayGgR-WeoCvQ',
    'channelTitle': 'TheEllenShow',
    'description': "Harry, Liam, Louis and Niall played a round of Ellen's revealing game. How well do you know the guys of One Direction?",
    'liveBroadcastContent': 'none',
    'publishedAt': '2015-11-18T14:00:00.000Z',
    'thumbnails': {'default': {'height': 90,
      'url': 'https://i.ytimg.com/vi/-l2KPjQ2lJA/default.jpg',
      'width': 120},
     'high': {'height': 360,
      'url': 'https://i.ytimg.com/vi/-l2KPjQ2lJA/hqdefault.jpg',
      'width': 480},
     'medium': {'height': 180,
      'url': 'https://i.ytimg.com/vi/-l2KPjQ2lJA/mqdefault.jpg',
      'width': 320}},
    'title': 'Never Have I Ever with One Direction'}},]}

import pprint
for video in example["items"]:
    pprint.pprint(video["id"]["videoId"])

# Prints 'd8kCTPPwfpM'
# '-l2KPjQ2lJA'
</code></pre>

python json youtube youtube-api jupyter-notebook