thibaudgg / video_info

Get video info from Dailymotion, Vimeo, Wistia, and YouTube URLs.

Home Page:https://rubygems.org/gems/video_info

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

unexpected network error while fetching information about the video

justalever opened this issue · comments

unexpected network error while fetching information about the video

I've been battling this error message off and on within an app I'm working on. I create an access_token for testing and have since tried the client id but believe I'm getting rate limited.

I have video listings on nearly every page of the app. All I'm trying to do is grab the duration of vimeo videos and display them on the front end, nothing more. The app will work for a while but then eventually throws this error. I haven't tried it specifically with YouTube yet but that's not an option for the app as it stands.

Do I need to go a different route and do an oEmbed type of solution or is there something I'm missing here?

Thanks in advance!

Ruby 2.4.1
Rails 5.1

Hi @justalever. First off let me say I've been extremely busy recently, but I will try to give this more attention this week.

First off, an obvious issue with the gem is you're getting that cryptic error message. At the very least it should contain the response code. I'll make an issue for that. Right now, with the information provided, I can't really say too much about your error.

Assuming you are getting rate limited, I don't think there's much you can do at this very moment with this gem. Some things we can do is allow the end-user to adjust the JSON filter and provide access to the X-RateLimit-Limit, X-RateLimit-Remaining, and X-RateLimit-Reset headers.

Do I need to go a different route and do an oEmbed type of solution or is there something I'm missing here?

I don't believe you're missing anything. oEmbed could very well be a good thing to try. Unfortunately I can't provide much information about that right now.

Have you tried it on more than one machine on more than one connection? Can you reproduce the error in irb? Do you have any idea how many API calls you are making in a given time frame?

@vheuken Thanks for the quick reply! No worries at all on urgency. I'm just trying to wrap my head around what could be the issue. I'll try it in irb and see how it goes. As far how many API calls I'm making, it could be quite a bit. The app is a course type of app and each video lesson will display duration alongside it. I'm assuming on each page load that number can grow fast which I knew could be an issue.

My end goal is to get the duration of all the videos at once to save me from having to enter each duration as a string upon creating the record.

The js-api (player.js) limits me to videos on the page whereas I'm trying to grab durations from other pages/records as well so it's getting rather complicated :)

Resurrecting this old issue as I was also running into it recently. I noticed that it only seems to occur when I'm requesting the duration, similar to @justalever.

Seems strange but is it something with the duration property itself?

I'm only dealing with YouTube and Vimeo in my app.

@justalever @mguidetti is this still an issue on recent versions?

Closing... @vheuken proposal is tracked in #178.