Home>

I'd like to create a search site that uses a keyword search and a filter that narrows down the total number of views using the Youtube API in Ruby on Rails, but I'm not sure how the Youtube api and the search function are linked.
What I want to achieve is to make the find_videos method work with: keyword in index.html.erb.
■■ The following error message occurred while implementing the function.

Source code
index.html.erb
<% if logged_in?%>

Login completed user:<% = current_user.name%>

<% = form_with url:'/', method:: get, local: true do | f |%> <% = f.text_field: search,: value =>@keyword%> <% = f.submit'Search', class:'btn btn-primary'%> <% end%>
Videos
<% @ results.items.each do | item |%> <% snippet = item.snippet%>

<% = snippet.title%>

<% = snippet.channel_title%>

<% end%>
<% else%> <% = render'sessions/new'%> <% end%> toppages_controller class ToppagesController
Supplementary information (FW/tool version, etc.)

The tool I'm using is AWS.
The find_videos method was based on this article.
https://qiita.com/sakakinn/items/46c0d4945e4646f346f6

  • Answer # 1

    Sample application for searching videos from Youtube with Ruby on Rails (Libxml-Ruby edition)
    The information is old and the API is used differently in search (searchForLibXML, getTitlesByLibXML, etc.)
    I wonder why the basic movements are helpful

Related articles