Created
April 8, 2012 16:43
-
-
Save nikushi/2338391 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/usr/bin/env ruby | |
# | |
# Dump subtitle in text for TED | |
# | |
require 'json' | |
require 'open-uri' | |
base_url = 'http://www.ted.com/talks/subtitles' | |
id = 1183 | |
url = "#{base_url}/id/#{id.to_s}/lang/eng" | |
data = JSON.parse(open(url).read) | |
if data && data.key?('captions') | |
data['captions'].each do |sentence| | |
puts sentence['content'] | |
puts | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment