This commit is contained in:
Ruling-Mac 2015-10-21 20:27:43 +08:00
parent 097b781a27
commit 65920c0f69
2 changed files with 4 additions and 5 deletions

View File

@ -34,11 +34,7 @@ class VideosController < ApplicationController
result = JSON.parse(result)
vc = []
video_channels.each do |video_channel|
channel_id = video_channel.channel_link.split("/")[-1]
uri = URI('https://www.googleapis.com/youtube/v3/search?part=snippet&channelId=' + channel_id + '&key=AIzaSyCTFdyLgb7GJfrr1JOI3gvVslZFw7td2zQ')
result = Net::HTTP.get(uri) # => String
result = JSON.parse(result)
result.each do |video_channel|
nextPageToken = result['nextPageToken'] rescue ""
while !nextPageToken.nil?
vc << {

View File

@ -13,4 +13,7 @@ class VideoChannel
field :channel_link
field :description , localize: true
def self.find_by_param(input)
self.find_by(uid: input)
end
end