Download only 1mb of file and use title in filename #11609

Open
sant527 opened this Issue Jan 5, 2017 · 4 comments

Projects

None yet

3 participants

@sant527
sant527 commented Jan 5, 2017

I am using the below to download only 1 mb of the file.

youtube-dl -v URL -o - | head -c 1000000 > output.mp4

can i use %(title)s.%(ext)s instead of output.mp4

@shizeeg
Contributor
shizeeg commented Jan 5, 2017 edited

head is a separate utility so you can't use youtube-dl formatting with it. But may call
youtube-dl URL -o - | head -c 1000000 > "$(youtube-dl URL --format '%{title}s.%{ext}s' --get-filename)"

@yan12125
Collaborator
yan12125 commented Jan 5, 2017

In youtube_dl/downloader/common.py, change this line:

    _TEST_FILE_SIZE = 10241

To:

    _TEST_FILE_SIZE = 1048576

And then download with:

youtube-dl --test <url>

But what's your purpose?

@sant527
sant527 commented Jan 5, 2017 edited

I have to download of lot of videos to see their content. I want to limit the download to 1mb even if the size is big. Because i just want to have a glimpse.

It didnt solve the problem. if the mp4 is in fragments. then --test will check with respect to the size of the fragment rather than the total file size.

@yan12125
Collaborator
yan12125 commented Jan 6, 2017

OK I got it.

if the mp4 is in fragments. then --test will check with respect to the size of the fragment rather than the total file size.

Sounds like a bug. Could you share the URL of such a video?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment