yt
yt copied to clipboard
Yt::Collections::Videos#includes
I'm trying to manually retrieve some videos with their contentDetails included.
The following does not work as expected:
Yt::Collections::Videos.new.includes(:content_details).where(id: ids)
It generates an HTTP call with part=snippet (not part=snippet,contentDetails as expected).
There also appears to be some kind of bug in eager_load_items_from where it's using item['id']['videoId'] while it should be using item['id'] (the method attributes_for_new_item seems to do it correctly by first checking use_list_endpoint?).
Am I doing something wrong or is this a bug? Thanks
part = 'snippet,contentDetails'
Yt::Collections::Videos.new.where(id: video_id, part: part).first
I think includes is used for something else.
That doesn't quite work either. This is the workaround I'm using right now, in case anyone else stumbles over the same problem:
hack = Yt::Collections::Videos.new.includes(:snippet, :content_details).where(id: ids, part: 'snippet,contentDetails')
response = hack.send(:list_request, hack.send(:list_params)).run
I'm closing this issue because it seems working somehow. If you open a pr for an improvement, that would be great!