Last active
August 10, 2017 09:54
Revisions
-
ParthBarot-BoTreeConsulting revised this gist
Aug 10, 2017 . 1 changed file with 6 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,6 +2,7 @@ # # Old code, which has a loop and sends API call for each video ID # video_ids.map do |video_id| Yt::Video.new(id: video_id).select(:snippet, :content_details, :statistics, :status) end @@ -10,6 +11,9 @@ # #New code, which fetches all the videos (max upto 12 IDs only) at once # @videos = Yt::Collections::Videos.new.where(id: video_ids, #video_ids has at max 12 ids only! part: 'id,snippet,content_details,statistics,status' ) @videos.first #This is needed to initiate the YT API call and load the data. -
ParthBarot-BoTreeConsulting created this gist
Aug 10, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,15 @@ # # Old code, which has a loop and sends API call for each video ID # video_ids.map do |video_id| Yt::Video.new(id: video_id).select(:snippet, :content_details, :statistics, :status) end # #New code, which fetches all the videos (max upto 12 IDs only) at once # Yt::Collections::Videos.new.where(id: video_ids, #video_ids has at max 12 ids only! part: 'id,snippet,content_details,statistics,status' )