YT宝石设置没有得到适当的回复

时间:2016-03-30 16:15:02

标签: ruby-on-rails youtube-api youtube-data-api

我使用bundler安装了yt gem。设置过程指出,如果我在命令行输入yt info,我应该得到以下结果

Yt version 0.25.6
Hello, world!

我得到了版本,但没有得到预期的结果:

Yt version 0.25.26
/Users/michael/.rvm/gems/ruby-2.2.3/gems/yt-0.25.26/lib/yt/request.rb:83:in `run': A request to YouTube API caused an unexpected server error: (Yt::Errors::ServerError)
{}

You can retry the same request manually by running:
curl -X GET -H "content-length: 0" -H "user-agent: Yt::Request (gzip)" "https://www.youtube.com/annotations_invideo?key=AIzaSyBSvIOM0EGX1tcrf5IAlYJuH_ttqVgTO4Q&video_id=BPNYv0vd78A"

但是,如果我手动请求内容,它可以正常工作:

Michaels-MacBook-Air-2:yt michael$ curl -X GET -H "content-length: 0" -H "user-agent: Yt::Request (gzip)" "https://www.youtube.com/annotations_invideo?key=AIzaSyBSvIOM0EGX1tcrf5IAlYJuH_ttqVgTO4Q&video_id=BPNYv0vd78A"
<?xml version="1.0" encoding="UTF-8" ?><document><annotations><annotation author="" id="annotation_1585555999" log_data="xble=1&amp;ei=Vvn7Vq35LIej-AXX8IeYAg&amp;a-v=BPNYv0vd78A&amp;a-type=4&amp;a-id=annotation_1585555999" style="title" type="text"><TEXT>Hello, world!</TEXT><segment><movingRegion type="rect"><rectRegion d="0" h="25.2779998779" t="0:00.000" w="75.0" x="13.1540002823" y="67.3239974976" /><rectRegion d="0" h="25.2779998779" t="0:02.089" w="75.0" x="13.1540002823" y="67.3239974976" /></movingRegion></segment><appearance bgAlpha="0.25" bgColor="0" borderAlpha="0.10000000149" effects="" fgColor="16777215" fontWeight="bold" highlightFontColor="16777215" textSize="21.6642" /></annotation>
<annotation id="channel:563d3ce4-0000-20cc-8fd5-001a11463304" style="playlist" type="promotion"
          log_data="ret-t=2&amp;a-ch=UCwCnUcLcb9-eSrHa_RQGkQQ&amp;a-type=12&amp;a-v=BPNYv0vd78A&amp;xble=1&amp;ret-exp=-4&amp;link-id=PLuW4g7xujBWfU26JUTW1DGs3hk4LD5KaL&amp;ei=Vvn7Vq35LIej-AXX8IeYAg&amp;ret-smrt=1&amp;a-id=563d3ce4-0000-20cc-8fd5-001a11463304">
<data>{&quot;text_line_2&quot;:&quot;Adorable Kids&quot;,&quot;is_mobile&quot;:false,&quot;text_line_1&quot;:&quot;Check this playlist&quot;,&quot;playlist_length&quot;:&quot;187&quot;,&quot;end_ms&quot;:3000,&quot;start_ms&quot;:1000,&quot;collapse_delay_ms&quot;:86400000,&quot;image_url&quot;:&quot;https:\/\/i.ytimg.com\/vi\/deG1wnpgL1s\/mqdefault.jpg&quot;}</data>
<segment/>
<action trigger="click" type="openUrl">
  <url type="hyperlink" target="new" value="https://www.youtube.com/watch?v=deG1wnpgL1s&amp;list=PLuW4g7xujBWfU26JUTW1DGs3hk4LD5KaL&amp;annotation_id=563d3ce4-0000-20cc-8fd5-001a11463304&amp;feature=iv&amp;ei=Vvn7Vq35LIej-AXX8IeYAg&amp;src_vid=BPNYv0vd78A"/>
</action>
</annotation>
</annotations></document>

在阅读了可能的解决方案后,我重新安装了rvm和openssl,但它没有工作

Michaels-MacBook-Air-2:yt michael$ openssl version
OpenSSL 1.0.2g  1 Mar 2016
Michaels-MacBook-Air-2:yt michael$ rvm version 
rvm 1.27.0 (latest) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]

0 个答案:

没有答案