jazzband / django-downloadview

Serve files with Django.
https://django-downloadview.readthedocs.io
Other
374 stars 57 forks source link

How to use HTTPDownloadView with generic.View #137

Closed apoorvaeternity closed 7 years ago

apoorvaeternity commented 7 years ago

I want to serve download files based on the request from an external server.I cannot fix the download url as there are many files.How to use the HTTPDownloadView with it.

Natim commented 7 years ago

What is your URL, how do you decide which file to return?

apoorvaeternity commented 7 years ago

I am trying to download videos from youtube.If I download the files using html download attribute their name is the default one.HTML5 download attribute does not rename the file if it is on another server.I want to rename them so I am using HTTPDownloadView which is doing the job for me.

I am able to get youtube video download links using pafy and youtube-dl. I want the user select the video quality and I want to rename the file to xyz.mp4 not videoplayback.mp4 which is the default name.

How to do it?

Natim commented 7 years ago

What it your current download URL?

http://localhost:800/video/vid/videoplayback.mp4

?

apoorvaeternity commented 7 years ago

https://youtube-video-downloader.herokuapp.com/

Here it's a sample. Paste a youtube video link in the field and get the download links.' When you try to download a file.The filename will be videoplayback.mp4 by default. I want to rename it to title of the video.

Natim commented 7 years ago

Ok, then you need to implement a get_basename() method to your view so that you can return the correct filename with regards to the video

apoorvaeternity commented 7 years ago

Got it thanks.