Skip to content

Instantly share code, notes, and snippets.

@rehat
Created August 12, 2015 04:12
Show Gist options
  • Save rehat/99b74b1e62cc91a8aa20 to your computer and use it in GitHub Desktop.
Save rehat/99b74b1e62cc91a8aa20 to your computer and use it in GitHub Desktop.
open inside HTML is open-uri and the open on line 4?
page = Nokogiri::HTML(open(video_url))
video_file_url_re.match(page) {|url|
open(save_file_as, 'wb') do |file|
file << open(url.to_s,
content_length_proc: proc { |total|
if total.to_i > 0
progress_bar = ProgressBar.create(title: 'Downloaded', total: total)
end
},
progress_proc: proc { |step|
progress_bar.progress = step
}
).read
end
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment