Created
July 30, 2017 17:24
-
-
Save GusGA/71e0fe30f3da97816133acfd3a0a7f42 to your computer and use it in GitHub Desktop.
Descargas videos de listados m3u8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'smarter_csv' | |
require 'i18n' | |
require 'uri' | |
I18n.config.available_locales = :en | |
def filename(index, name) | |
new_name = I18n.transliterate(name.split(' ').map(&:downcase).join('_')).gsub("?",'') | |
return "#{index + 1}_#{new_name}.mp4" | |
end | |
PATH = 'links.csv' | |
@data = SmarterCSV.process(PATH) | |
@data.each_with_index do |datum, index| | |
puts '=' * 100 | |
puts "Converting #{datum[:name]}" | |
sleep 2 | |
command = "ffmpeg -i '#{URI.unescape(datum[:url])}' -bsf:a aac_adtstoasc -vcodec copy -c copy -crf 50 #{filename(index, datum[:name])}" | |
puts '=' * 20 | |
puts command | |
puts '=' * 20 | |
system(command) | |
sleep 2 | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment