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?

emil mircea asked in Gems / Libraries

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

Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 82,464+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.