|
|
|
@ -45,13 +45,18 @@ namespace :video do
|
|
|
|
|
|
|
|
|
|
task :get_play_url => :environment do
|
|
|
|
|
Video.all.each do |video|
|
|
|
|
|
result = AliyunVod::Service.get_play_info(video.uuid)
|
|
|
|
|
puts result
|
|
|
|
|
play_url = result["PlayInfoList"]["PlayInfo"].first["PlayURL"]
|
|
|
|
|
puts play_url
|
|
|
|
|
# play_url = (result.dig('PlayInfoList', 'PlayInfo') || []).first&.[]('PlayURL')
|
|
|
|
|
if video.uuid.present?
|
|
|
|
|
|
|
|
|
|
video.update!(play_url: play_url) if play_url.present?
|
|
|
|
|
end
|
|
|
|
|
result = AliyunVod::Service.get_play_info(video.uuid) rescue nil
|
|
|
|
|
if result.present? && result["PlayInfoList"]["PlayInfo"].present?
|
|
|
|
|
puts result
|
|
|
|
|
play_url = result["PlayInfoList"]["PlayInfo"].first["PlayURL"]
|
|
|
|
|
puts play_url
|
|
|
|
|
# play_url = (result.dig('PlayInfoList', 'PlayInfo') || []).first&.[]('PlayURL')
|
|
|
|
|
|
|
|
|
|
video.update!(play_url: play_url) if play_url.present?
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|