lundi 4 mai 2015

Why am I getting 400 bad error if I put 1 into page? and it won't fetch more than 25 results?

I'm using the gem called youtube search

I coded like this below works fine. But it returns 400 Bad error when I type 1 into page like this

<% option = {
  :per_page => "10",
  :page     => 1,
}
%>

How can I fix this code to display first page of the result?

Then why it always show 25 when trying to show the number of matches that contains "cats" as the keyword?
It should be more than 10000 matches :(

# coding: utf-8


<% keyword = "cats" %>
<% option = {
  :per_page => "10",
  :page     => 2,
}
%>

<% videos = YoutubeSearch::search(keyword, option) %>

Video Count<%= YoutubeSearch::search(keyword).count %>


--------------------------------<br />
<br />

<% videos.each do |video| %>

Video ID:<%= video["video_id"] %> <br />
<iframe width="560" height="315" src="http://ift.tt/1PhTStS video["video_id"] %>" frameborder="0" allowfullscreen></iframe> <br />
  Title: <%= video["title"] %><br />
  Content: <%= video["content"] %><br />
  ----------------------------------------------------------------------------------------------<br />
  <br />
<% end %>

Aucun commentaire:

Enregistrer un commentaire