<?php
/**
 * Yt_EVL_Source_YouTube_Playlist
 * 
 * Find Videos from a YouTube Playlist
 * 
 * @package Yt_Evolution
 * @subpackage Classes
 * @author  Chris Derenberger <https://www.ytevolution.com>
 * @copyright Copyright 2020, YTEVOLUTION®
 * @link https://www.ytevolution.com
 * @since 1.0.0
 */

class Yt_EVL_Source_YouTube_Playlist Extends Yt_EVL_Source {
  
  function __construct( $id ) {
    
    parent::__construct( $id ); 
    
  }


  function get_source_videos(  $search_args ){       
        
    // Get the guid for this source
    $youtube_playlist_id = $this -> guid;    
    
    

    
    // Get the vidoes for this source
    $playlist_videos = Yt_Evolution::$tube_youtube_videos->get_youtube_playlist_videos_via_api( $youtube_playlist_id, $search_args );
        
    // Return the videos
    return $playlist_videos;
    
  }
  
   function get_source_videos_since_last_import(  $last_import_date , $token ='') {
      $youtube_playlist_id = $this -> guid;  
      $search_args['maxResults'] = 5;
      $search_args['pageToken'] = $token;
     // $search_args['get_all'] = true;
     $playlist_videos = Yt_Evolution::$tube_youtube_videos->get_youtube_playlist_videos_via_api( $youtube_playlist_id, $search_args );
    //print_r($channel_videos['items']);
     
   
    return $playlist_videos;
    
  }
  
  
}