Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I specify path for downloaded files #7009

Closed
asholok opened this issue Sep 28, 2015 · 2 comments
Closed

How can I specify path for downloaded files #7009

asholok opened this issue Sep 28, 2015 · 2 comments

Comments

@asholok
Copy link

@asholok asholok commented Sep 28, 2015

Can I put downloaded file to custom directory or throw file thru django model:

from future import unicode_literals
from my_app.models import Profile
import youtube_dl

def download_video(request):

ydl_opts = {}
with youtube_dl.YoutubeDL(ydl_opts) as ydl:

info_dict = ydl.extract_info('http://www.youtube.com/watch?v=wRmxuEZj1v4', download=True)
Profile.video.save(info_dict.get('title', ''), ydl._screen_file)

  • I want to avoid double save of video file, first to the script location, and second to the model location.
  • if it's not possible how I can specify first save to the custom temp location
@jaimeMF
Copy link
Collaborator

@jaimeMF jaimeMF commented Sep 28, 2015

Isn't outtmpl` enough? You can use:

ydl_opts = {'outtmpl': '/path/to/folder/%(title)s-%(id)s.%(ext)s'}
@asholok
Copy link
Author

@asholok asholok commented Sep 28, 2015

Thx, It might help me.

@asholok asholok closed this Sep 28, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.