samedi 27 juin 2015

Why is it too slow to fetch the records?

I'm using the gem called 'yourub' to fetch information of multiple videos narrowed down by particular keyword.

My code is just like this and it works fine but too slow until the result start showing up on the page.
Is it because I'm using the gem? Does it get faster if I do the same thing with native way of using "google-api-client" gem? If so how can I replace my original?

P.S. According to the document of 'yourub', it only can fetch up to 50 videos:( and it cannot even choose which page of the result to show with pagination select :(

My code(View)

<% client = Yourub::Client.new %>

<% client.search(query: "cat", order: "date", max_results: 30) do |video| %>

Video ID:<%= video["id"] %> <br />
Title: <%= video["snippet"]["title"] %><br />
<img src="<%= video["snippet"]["thumbnails"]["high"]["url"] %>" with="480" height="360"><br />
----------------------------------------------------------------------------------------------<br />
  <br />
<% end %>

Aucun commentaire:

Enregistrer un commentaire