B
B
bmalets2015-10-30 19:57:37
YouTube
bmalets, 2015-10-30 19:57:37

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)

But, when I use my channel, in which I uploaded 2 videos, strange incomprehensible things appear:
Yt::Channel.new(id: 'UCjBR9x-hg44guAAgFFzm-6w').video_count
# => 4 (incorrect)
Yt::Channel.new(id: 'UCjBR9x-hg44guAAgFFzm-6w').videos.count
# => 2 (correct)

Why is the wrong number of videos returned?
How to fix it?
Thanks!

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question