From b53ff71f97853e29d2d0350def8d746a2d090e17 Mon Sep 17 00:00:00 2001 From: Nick/Nelson Date: Thu, 21 Sep 2017 00:05:49 +0000 Subject: [PATCH] Add support for video posts --- vsco-dl.rb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/vsco-dl.rb b/vsco-dl.rb index 263b310..d8ce65e 100644 --- a/vsco-dl.rb +++ b/vsco-dl.rb @@ -54,10 +54,11 @@ images.each_with_index do |r, i| end end - jpg_path = "#{file_path}.jpg" - if options[:overwrite] or not File.exist? jpg_path - open "https://#{r['responsive_url']}" do |f| - File.open jpg_path, 'wb' do |file| + image_url = r['is_video'] ? r['video_url'] : r['responsive_url'] + image_path = "#{file_path}#{File.extname image_url}" + if options[:overwrite] or not File.exist? image_path + open "https://#{image_url}" do |f| + File.open image_path, 'wb' do |file| file.write f.read end end