Menu

Handling video and podcast links in a Rails app with Active Job
🎙️

Handling video and podcast links in a Rails app with Active Job

DEV Community: rails·Yusuf Yildiz·4 days ago
#1ovpfOaQ
#devtorails#devto#dev#status#importly
Long article (1086 words) — no AI summary yet.
Reading 0:00
15s threshold

A lot of Rails apps end up with the same feature: a user pastes a YouTube, TikTok or podcast link, and the app needs the transcript or the file. It works in development. Then it runs on a server and the media job is the one that breaks: sites block datacenter IPs, and plenty of videos have no captions to read.

I built Importly for this, so that's what this post calls. You send it a link and get back the transcript, a download link for the file, or the video's details, and it works from servers. The part worth getting right in Rails is the job side, so that's most of this post. It's plain Active Job and Net::HTTP , so it runs on Sidekiq, Solid Queue or GoodJob.

Long imports can take a few minutes, so don't hold a worker for them. One job starts the Importly job and stores its ID, and a second job checks the status and enqueues itself again 20 seconds later until it's done.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.