-
-
Save simi/b6399db3708ab26bece8b668ea6d799a to your computer and use it in GitHub Desktop.
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 'open-uri' | |
require 'json' | |
uid = ARGV[0] | |
puts "downloading #{uid}" | |
response = JSON.parse(URI.open("https://api.mujrozhlas.cz/serials/#{uid}/episodes").read) | |
response["data"].each do |episode| | |
attributes = episode["attributes"] | |
serial = attributes["mirroredSerial"] | |
total_parts = serial["totalParts"].to_s | |
part = attributes["part"].to_s.rjust(total_parts.length, "0") | |
name = "#{part}-#{total_parts} - #{attributes["title"]}.mp3" | |
link = attributes["audioLinks"].first["url"] | |
puts "downloading #{link} to #{name}" | |
audio = URI.open(link) | |
file = File.open(name, 'wb') | |
IO.copy_stream(audio, file) | |
end |
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
$ ruby download.rb d51df021-bceb-36e0-a65c-38ec64b3f8a5 | |
downloading d51df021-bceb-36e0-a65c-38ec64b3f8a5 | |
downloading https://croaod.cz/download/aaaaedff-e642-4752-942e-5c0c9c140687.mp3 to 01-14 - O Křesomyslu a Horymírovi.mp3 | |
downloading https://croaod.cz/download/5c2dcc4e-6331-4126-b24a-3f1028421cef.mp3 to 02-14 - Faustův dům.mp3 | |
downloading https://croaod.cz/download/b20df09c-cb4e-4ddf-9471-fa09d7dab113.mp3 to 03-14 - O Bruncvíkovi.mp3 | |
downloading https://croaod.cz/download/655438f9-5913-4bb9-9f46-817d0e0a827a.mp3 to 04-14 - O králi Ječmínkovi.mp3 | |
downloading https://croaod.cz/download/2c899b71-7f1f-4b6a-bb03-90586a2c242b.mp3 to 05-14 - Dívčí válka.mp3 | |
downloading https://croaod.cz/download/f91b7c29-9adc-47d1-adfe-a0e6dbcf9511.mp3 to 06-14 - Blaničtí rytíři.mp3 | |
downloading https://croaod.cz/download/66c69eb4-e4de-4e1e-835f-52f9a00ce2e7.mp3 to 07-14 - Ze starobylých proroctví.mp3 | |
downloading https://croaod.cz/download/75445f89-4525-46e8-b7b5-874ff0248bb9.mp3 to 08-14 - O Daliborovi z Kozojed.mp3 | |
downloading https://croaod.cz/download/f1c0efa4-2e92-4c09-9f55-5b3e1e87850f.mp3 to 09-14 - O králi Václavovi.mp3 | |
downloading https://croaod.cz/download/30afea5d-b893-4d98-9e34-41d198473f7c.mp3 to 10-14 - O staré Praze.mp3 | |
downloading https://croaod.cz/download/8668d850-f1aa-42ad-adf3-9734d27dd03c.mp3 to 11-14 - Žito kouzelník.mp3 | |
downloading https://croaod.cz/download/b6b473e2-1c04-4ce0-8545-0a6bf5b93fb2.mp3 to 12-14 - Staroměstský orloj.mp3 | |
downloading https://croaod.cz/download/fedd178c-1c70-4291-af12-a8455e1e4fd5.mp3 to 13-14 - Smutná místa.mp3 | |
downloading https://croaod.cz/download/0cfb1825-830f-4724-96f2-d3a62aebe2ab.mp3 to 14-14 - Ze židovského města.mp3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment