Extract YouTube transcripts in Ruby using the standard library or gems like Faraday and HTTParty. Build Rails features, Sidekiq jobs, or command-line tools that process YouTube captions at scale.
gem install faradayrequire "faraday"
require "json"
api_key = ENV["YT_TRANSCRIPTS_API_KEY"]
video_url = "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
conn = Faraday.new(url: "https://api.youtubetranscripts.co") do |f|
f.request :url_encoded
end
response = conn.get("/v1/transcript") do |req|
req.params["url"] = video_url
req.headers["x-api-key"] = api_key
end
data = JSON.parse(response.body)
puts "Title: #{data['title']}"
puts "Channel: #{data['channel']}"
data["transcript"].each do |segment|
puts "[#{'%.1f' % segment['start']}s] #{segment['text']}"
endWorks with Faraday, HTTParty, or Net::HTTP
Perfect for Rails controllers and Sidekiq jobs
JSON response maps naturally to Ruby hashes
Great for CLI tools and automation scripts
Batch API for processing channels and playlists
Compatible with Ruby 2.7+ and Ruby 3.x
Sign up in 30 seconds. Get 150 free API requests. No credit card required. Your Ruby integration can be live in minutes.