获取视频url

dev_video
cxt 5 years ago
parent e0546de08c
commit b1a9a5c0e8

@ -0,0 +1,5 @@
class AddPlayUrlToVideos < ActiveRecord::Migration[5.2]
def change
add_column :videos, :play_url, :string
end
end

@ -42,4 +42,13 @@ namespace :video do
puts data
end
end
task :get_play_url => :environment do
Video.all.each do |video|
result = AliyunVod::Service.get_play_info(video.uuid)
play_url = (result.dig('PlayInfoList', 'PlayInfo') || []).first&.[]('PlayURL')
video.update!(play_url: play_url) if play_url.present?
end
end
end
Loading…
Cancel
Save