Skip to main content
Ask A Question
You’re not receiving notifications from this thread.

How do I make an app to get a video by url from youtube download it / process it/ and uploaded to a local db?

Gems / Libraries • Asked by emil mircea

I liked the shrine tutorials and would like to use that as an upload to local disk solution.
I also found a gem called youtube-dl ( to help download from Youtube.
I have no clear idea about how to combine the two gems into a solution (user puts in url -> video is being downloaded and uploaded to local db)

Hey Emil,

For the most part, you can just plug in Shrine by opening up a File object in Ruby and then assigning it to the shrine attribute and calling save. That's basically the same process that Shrine uses on a browser upload so there is little to no difference to do this from an already downloaded file.

download ="PATHTOFILE", "rb")
@record = Record.where(youtube_id: ID).first_or_create = download

You might need to delete the file you downloaded once this is complete so you don't have duplicate files on disk.

Thanks for the answer. I'll give it a try

Login or Create An Account to join the conversation.

Subscribe to the newsletter

Join 31,353+ developers who get early access to new screencasts, articles, guides, updates, and more.

    By clicking this button, you agree to the GoRails Terms of Service and Privacy Policy.

    More of a social being? We're also on Twitter and YouTube.