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

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

Open
sant527 opened this issue Jan 5, 2017 · 7 comments
Open

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

sant527 opened this issue Jan 5, 2017 · 7 comments
Labels

Comments

@sant527
Copy link

@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
Copy link
Contributor

@shizeeg shizeeg commented Jan 5, 2017

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
Copy link
Collaborator

@yan12125 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
Copy link
Author

@sant527 sant527 commented Jan 5, 2017

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
Copy link
Collaborator

@yan12125 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?

@sant527
Copy link
Author

@sant527 sant527 commented Feb 14, 2017

youtube-dl --test --restrict-filenames --no-part -f '[width<=500][ext=flv]' -o "%(title)s_f%(format_id)s.%(ext)s" "https://www.bloomberg.com/news/videos/2017-02-14/is-the-banking-environment-getting-better"

i have _TEST_FILE_SIZE = 4048576

Goal to achive: i dont want to download more than 4mb of file size.

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Feb 14, 2017

Bloomberg is a special case - if you cut the video randomly, it's likely you'll get a broken file. Try to set _TEST_FILE_SIZE to a smaller size.

@fjjhdsvjhsdjj
Copy link

@fjjhdsvjhsdjj fjjhdsvjhsdjj commented Mar 15, 2017

Hi,
is there a way to pass this _TEST_FILE_SIZE as a parameter on the command line(or on the youtube-dl.conf)?

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
4 participants
You can’t perform that action at this time.