Closed chandraprinovis closed 9 years ago
You can only get maximum of 50 items from the Youtube API. Try: cp = Playlist.first(:reference => p.playlist_id, :max_results => 50)
Hi Tekkenator, Thank you for replying. I solved it by checking out the other thread in the issues. def self.all_videos_from_playlist(playlist_id) all_videos = [] start_index, page_size = 1, 50
begin @client = YouTubeIt::Client.new(:dev_key => YOUTUBE_DEV_KEY) playlists = @client.playlists(YOUTUBE_SRC_USER) newest_videos = @client.playlist(playlist_id, {'start-index' => start_index, 'max-results' => page_size}).videos all_videos += newest_videos start_index += page_size end while newest_videos && newest_videos.size == page_size
all_videos end
The above code works fine.
With regards, c
Dear Friends,
I'm trying to use the Youtube_it gem to pull in a list of videos and store the urls, but the built in objects are only giving me 25 items max each time. Does anyone know of a way to use this gem to do this? cp = Playlist.first(:reference => p.playlist_id) cp = Playlist.create if cp.nil? cp.reference = p.playlist_id cp.title = p.title cp.summary = p.summary cp.save
Video Import
could you tell me how to get maximum videos or all videos from the playlist?
with regards, C