text: import yaml
  
  #  Ini modul koneksi ke Youtube data API v3
  #  harus ada api_key
  #
  #   Contoh file api.yaml
  #   api_key: 'blabablablabla'
  #   api key youtube data v3 - only for read data.
  
  f = open('api.yaml','rt')
  config = yaml.load(f, Loader=yaml.FullLoader)
  f.close()
  
  api_key = config['api_key']
  #print(api_key)
  
  from googleapiclient.discovery import build
  youtube = build('youtube', 'v3', developerKey=api_key)
  
  def _ytb_video(id=""):
      client = youtube.videos().list(part='snippet,contentDetails,statistics',id=id)
      response = client.execute()
      vid_url = 'https://youtube.com/watch?v='+str(id)
      vid_detail = []
      vid_detail.append(response['items'][0]['snippet']['title'])
      vid_detail.append(vid_url)
      try:
          vid_detail.append(response['items'][0]['snippet']['thumbnails']['standard']['url'])
      except: pass
      return vid_detail
  
  def _ytb_playlist(id=""):
      client = youtube.playlistItems().list(
          part="contentDetails",
          maxResults = 50,
          playlistId=id
      )
      response = client.execute()
      response = response['items']
      vid_ids = []
      for i in response:
          vid_ids.append(i['contentDetails']['videoId'])
      return vid_ids
  
  def get_content(playlist):
      myvid = _ytb_playlist(playlist)
      videos = []
      for vid in myvid:
          try:
              videos.append(_ytb_video(vid))
          except:
              pass
      return videos
  
  
  if __name__ == '__main__':
      #myvid = _ytb_playlist('PLxBhf17jrfxEnd8SZOxNyEc6cgZZZWziH')
      #print(myvid)
  
      result = get_content('PLxBhf17jrfxEnd8SZOxNyEc6cgZZZWziH')
      print(result)
  