bo-oz / vimeo_me2 Goto Github PK
View Code? Open in Web Editor NEWVimeo API v3 wrapper for Ruby
License: MIT License
Vimeo API v3 wrapper for Ruby
License: MIT License
I am uploading video on vimeo . Video get uploaded on vimeo successfully but while return request
I got error "VimeoMe2::RequestFailed (Something went wrong)" .
Script :
vimeo_client = VimeoMe2::User.new('1254fg7856')
data_url = vimeo_client.upload_video(video_file)
More_detail_error :
PATCH https://api.vimeo.com/videos/223757270455
204 No Content
Completed 500 Internal Server Error in 352036ms
VimeoMe2::RequestFailed (Something went wrong)
Thanks In Advance .
Time to add some :)
What is the state-of-the-art for remote HTTP request mocking? Is it still VCR and family?
Please upload a ruby gem to rubygems.org as an alternative way to install this library. The README suggests to install the gem using the git repository, but this has some drawbacks, namely:
Adding releases to rubygems.org would still allow existing users to install using git if they prefer.
Thanks for the nice package!
EXAMPLE:
file = File.open("#{Rails.root}/public/recording/test/video.mp4")
@token = Rails.application.credentials.dig(:vimeo, :token)
@vimeo_client = VimeoMe2::User.new(@token)
@vimeo_client.upload_video(file)
the video is uploaded but return error.
To continue, contact our support team (make sure you have your IP address), and mention code W4A0F6
.
The gemspec currently requires v0.14 which is 5+ years old or so.
Is there a way to apply an embed preset to a video using this gem, either on upload or afterwards given the vimeo ID? The API has support for this:
https://developer.vimeo.com/api/reference/embed-presets?version=#add_video_embed_preset
Hello,
We've recently encountered certificate errors without any changes to our implementation of the Vimeo upload library. Have any of you experienced similar issues, and if so, please share any solutions or insights you may have.
Thank you!
Hi!
Recently the upload feature broke in the application I'm working on and after some debugging I discovered that the model on my app that stores the video is not being created (since I make a check for not creating it in case VimeoMe2::RequestFailed is raised) but the video does upload to vimeo when I check on my account via web browser.
The error message that comes from the exception is: "Please add a custom logo to your account."
I would love to help solving this, if anyone could me give clues or pointers on what is going on, I can start working on a PR.
Thanks in advance!
EDIT: While I'm still debugging here, I'll add more info about the problem to see if it helps.
The exception object has the following attributes after the raise:
e.status == "Bad Request"
e.error == 400
e.message == "Please add a custom logo to your account."
e.ratelimit == {"limit"=>"500", "remaining"=>"492", "reset"=>"2020-08-05T19:18:47+00:00"}
Since the error code is 400, I suppose it falls in one of the 'raise' calls on the http_request.rb
file in the validate_response!
method.
However, the fact that the request is returning code 400 but the video is actually being uploaded is really weird.
Hello,
I started having this issue recently and no longer can upload files to my vimeo account using the API. The code basically looks like this:
vimeo_client = VimeoMe2::User.new(Rails.application.config.vimeo_token)
vid_id = vimeo_client.upload_video(video_file)
The error I get is "Encoding::UndefinedConversionError: "\x84" from ASCII-8BIT to UTF-8. Here is the stack trace:
activesupport (5.1.6) lib/active_support/core_ext/object/json.rb:36:in `encode'
activesupport (5.1.6) lib/active_support/core_ext/object/json.rb:36:in `to_json'
activesupport (5.1.6) lib/active_support/core_ext/object/json.rb:36:in `to_json'
activesupport (5.1.6) lib/active_support/json/encoding.rb:55:in `to_json'
/usr/local/lib/ruby/2.4.0/json/common.rb:224:in `generate'
/usr/local/lib/ruby/2.4.0/json/common.rb:224:in `generate'
activesupport (5.1.6) lib/active_support/json/encoding.rb:100:in `stringify'
activesupport (5.1.6) lib/active_support/json/encoding.rb:33:in `encode'
activesupport (5.1.6) lib/active_support/json/encoding.rb:20:in `encode'
activesupport (5.1.6) lib/active_support/core_ext/object/json.rb:39:in `to_json'
/gems/2.4.1/bundler/gems/vimeo_me2-6960e41a4a5a/lib/vimeo_me2/http/http_request.rb:72:in `http_request'
/gems/2.4.1/bundler/gems/vimeo_me2-6960e41a4a5a/lib/vimeo_me2/http/http_request.rb:21:in `make_http_request'
/gems/2.4.1/bundler/gems/vimeo_me2-6960e41a4a5a/lib/vimeo_me2/base.rb:36:in `request'
/gems/2.4.1/bundler/gems/vimeo_me2-6960e41a4a5a/lib/vimeo_me2/base.rb:16:in `block (2 levels) in <class:VimeoObject>'
/gems/2.4.1/bundler/gems/vimeo_me2-6960e41a4a5a/lib/vimeo_me2/user/upload.rb:57:in `start_upload'
/gems/2.4.1/bundler/gems/vimeo_me2-6960e41a4a5a/lib/vimeo_me2/user/upload.rb:34:in `handle_upload'
/gems/2.4.1/bundler/gems/vimeo_me2-6960e41a4a5a/lib/vimeo_me2/user/upload.rb:11:in `upload_video'
app/models/component.rb:56:in `upload_hosted_file'
video_file is a ActionDispatch::Http::UploadedFile with content-type "video/mp4". Any idea why this would stop working, or if there is another way to accomplish the upload? Thank you very much for any help, and for making this gem in the first place - it is very helpful.
Greg
Hi everyone,
I am getting VimeoMe2::RequestFailed, Something strange occurred. Please try again. Here is my story:
I was using the vimeo_client.pull_upload with no problem, I made an new vimeo app with API 3.4 and updated the vimeo_me2 to 1.2 . and it refuses to go through the upload process and in vimeo_me2/http/http_request.rb:24 the request returns the following :
{"error":"Something strange occurred. Please try again.","link":null,"developer_message":"To access upload features for API version 3.4 when your app defaults to a different API version, include the Accept
header with your request, and set its value to 3.4
. For more details, see our versioning documentation at https://developer.vimeo.com/api/common-formats#versioning.","error_code":3116}
Everything seems ok, wonder what's causing this...
Thank you ...
Here's my code that was working after I submitted last pull request:
def upload_hosted_file
if video_file
vimeo_client = VimeoMe2::User.new(Rails.application.config.vimeo_token)
vid_id = vimeo_client.upload_video(video_file)
update_column(:vimeo_video_id, vid_id)
end
end
It now seems that upload_video(video_file) returns nil instead of the video id. I see that the upload_video implementation changed, so is there a new way to get the video id now?
Hello,
Thank you for this great gem :)
I use the gem 1.20 version with Vimeo API 3.4, but I get an error from Vimeo when trying to post a video : Error: Something strange occurred. Please try again.
The error disappear when I force the API version to 3.2.
Code to reproduce the error :
begin
vimeo = VimeoMe2::VimeoObject.new(VIMEO_TOKEN) # default api_version = 3.4
vimeo_response = vimeo.post('/me/videos', body: { type: 'pull', link: url }.to_query)
rescue VimeoMe2::RequestFailed => error
Rails.logger.info "Unable to create Vimeo video: #{error.message}" # Error: Something strange occurred. Please try again.
end
Code to skip the error :
begin
vimeo = VimeoMe2::VimeoObject.new(VIMEO_TOKEN, '3.2') # force api_version
vimeo_response = vimeo.post('/me/videos', body: { type: 'pull', link: url }.to_query)
rescue VimeoMe2::RequestFailed => error
Rails.logger.info "Unable to create Vimeo video: #{error.message}" # No more error
end
EDIT : I use Ruby 2.2.3 and Rails 3.2.22
Follow users method is not working. Somehow the request is not formatted correctly. Anyone know how to properly format an array of user URI's to put in the body of the POST request?
Currently there is no way to tell the number of made and remaining API calls.
https://developer.vimeo.com/guidelines/rate-limiting#how-to-tell
Hi!
Thanks in advance for this gem, it is very helpful. But I have a question, I can't configure the whitelisted domains, it's the only parameter that I can't edit, or even consult. Is it possible to perform that operation with this gem?
Regards!
Álvaro
I'm using the upload code provided on the README (Utilizing an upload form in Rails), but from some time until now it has stopped working.
I've put a puts e
command inside the rescue VimeoMe2::RequestFailed => e
exception rescue block and this is what it shows me upon trying to upload a new video:
Everything was working fine a few days ago. No changes were made in the vimeo API, as far as I'm concerned (double-checked the changelog today)
[3] pry(#)> vimeo_video = vimeo_client.upload_video(self.video_file)
ArgumentError: wrong number of arguments (given 2, expected 0..1)
from /Users/dk/.rvm/gems/ruby-3.0.0@services/bundler/gems/vimeo_me2-3296c6ba08cf/lib/vimeo_me2/base.rb:27:in `request'
while in ruby 2.6.5 it works fine
what could be broken on the code? I didn't find any clue yet...
Hello!
I'm using the gem with docker and docker compose.
My rails version is 3.2.13.
My ruby version is 2.1.2.
After installing the gem as the README suggests, (which doesn't install at the first bundle install, I have to enter the container and do it again manually) I get the following error message after attempting to start the rails server:
rake aborted!
/usr/local/lib/ruby/gems/2.1.0/bundler/gems/vimeo_me2-6d09c58acf06/lib/vimeo_me2/user/upload.rb:52: syntax error, unexpected ':', expecting =>
... headers = {'Content-Type': 'application/offset+octet-st...
... ^
/usr/local/lib/ruby/gems/2.1.0/bundler/gems/vimeo_me2-6d09c58acf06/lib/vimeo_me2/user/upload.rb:52: syntax error, unexpected '}', expecting keyword_end
/rails_app/config/application.rb:9:in `<top (required)>'
/rails_app/Rakefile:5:in `require'
/rails_app/Rakefile:5:in `<top (required)>'
(See full trace by running task with --trace)
Apparently this has been solved in this commit of one of the repo's forks:
BarefootCoders@aa695e0
Any chance to integrate this to the master?
Make sure to set a custom User Agent for your app. We will be much less likely to block access if we see a custom User Agent! We block certain generic User Agents now, and may block others in the future.
https://developer.vimeo.com/guidelines/best-practices#user-agents
This line defaults the name of uploaded video to video.mp4
video = File.open('video.mp4')
vimeo_client.upload_video(video)
One way to change it now is by updating after upload using
vimeo_video.name = "New name"
Is it possible to give a name to it at the time of upload? Something like
vimeo_client.upload_video(video, "New name")
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.