Answer the question
In order to leave comments, you need to log in
Does the 'yt' gem return the wrong number of videos in a youtube channel?
I am using gem "yt", '= 0.25.1' in my project and noticed a strange problem:
There is a #video_count method on the Channel model.
This method should return the number of videos in the channel.
And it, @channel.videos_count , is much faster than @channel.videos.count .
If we take for example the channel "Simon's Cat" which has 17 videos:
Yt::Channel.new(id: 'UCE3pZOwArJXDOQjcQsiQT_w').video_count
# => 17 (correct)
Yt::Channel.new(id: 'UCE3pZOwArJXDOQjcQsiQT_w').videos.count
# => 17 (correct)
Yt::Channel.new(id: 'UCjBR9x-hg44guAAgFFzm-6w').video_count
# => 4 (incorrect)
Yt::Channel.new(id: 'UCjBR9x-hg44guAAgFFzm-6w').videos.count
# => 2 (correct)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question