ytdl-org / youtube-dl

Command-line program to download videos from YouTube.com and other video sites
http://ytdl-org.github.io/youtube-dl/
The Unlicense
131.91k stars 10k forks source link

--max-filesize may not work #22133

Open triplesixman opened 5 years ago

triplesixman commented 5 years ago

Checklist

Verbose log

:~/test# youtube-dl --max-filesize 20m https://www.youtube.com/watch?v=h2zkV-l_TbY
[youtube] h2zkV-l_TbY: Downloading webpage
[youtube] h2zkV-l_TbY: Downloading video info webpage
[download] Destination: ☕ Restaurant Ambience • 10H Busy Coffee Shop Background Noise-h2zkV-l_TbY.f313.webm
[download]   0.2% of 5.55GiB at  5.91MiB/s ETA 15:59^C
ERROR: Interrupted by user

Description

Hello,

I notice that the "--max-size" function no longer works on youtube-dl updated.

chuckn408 commented 5 years ago

works for me:::

youtube-dl --max-filesize 20m https://www.youtube.com/watch?v=h2zkV-l_TbY [youtube] h2zkV-l_TbY: Downloading webpage [youtube] h2zkV-lTbY: Downloading video info webpage WARNING: Unable to extract video title [download] Destination: -h2zkV-lTbY.f313.webm [download] File is larger than max-filesize (30690430 bytes > 20971520 bytes). Aborting. [download] Destination: -h2zkV-l_TbY.f251.webm [download] File is larger than max-filesize (30429877 bytes > 20971520 bytes). Aborting.

Did you cancel it too prematurely?

triplesixman commented 5 years ago

Nope. It must have been fixed during a recent update, it works now. :)

ohhai commented 4 years ago

Sorry for the example, but it does not work everywhere, at least:

$ /usr/local/bin/youtube-dl --max-filesize 1m https://www.pornhub.com/view_video.php?viewkey=ph5e272646bddb8
[PornHub] ph5e272646bddb8: Downloading pc webpage
[PornHub] ph5e272646bddb8: Downloading m3u8 information
[PornHub] ph5e272646bddb8: Downloading m3u8 information
[PornHub] ph5e272646bddb8: Downloading m3u8 information
[PornHub] ph5e272646bddb8: Downloading m3u8 information
[hlsnative] Downloading m3u8 manifest
[hlsnative] Total fragments: 266
[download] Destination: Mom's secret night life - Crystal Rush-ph5e272646bddb8.mp4
[download]   1.9% of ~94.33MiB at 804.45KiB/s ETA 03:35^C
ERROR: Interrupted by user

Version:

[debug] youtube-dl version 2020.01.24
[debug] Python version 3.7.6 (CPython) - Linux-5.4.17-200.fc31.x86_64-x86_64-with-fedora-31-Thirty_One
[debug] exe versions: ffmpeg 4.2.2, ffprobe 4.2.2, phantomjs 2.1.1
marczz commented 4 years ago

With youtube-dl version 2020.03.24 it does not work even with the youtube-dl test video:

$ youtube-dl  --max-filesize 1M --restrict-filename https://www.youtube.com/watch?v=BaW_jenozKc
[youtube] BaW_jenozKc: Downloading webpage
[download] File is larger than max-filesize (2208750 bytes > 1048576 bytes). Aborting.
[download] Destination: youtube-dl_test_video_a-BaW_jenozKc.f140.m4a
[download] 100% of 154.06KiB in 00:00

But by using a format it is ok:

$ youtube-dl  -f "[filesize < 1M]" --restrict-filename https://www.youtube.com/watch?v=BaW_jenozKc
[youtube] BaW_jenozKc: Downloading webpage
[download] Destination: youtube-dl_test_video_a-BaW_jenozKc.mp4
[download] 100% of 354.29KiB in 00:01

Version:

[debug] youtube-dl version 2020.03.24
[debug] Python version 3.7.3 (CPython) - Linux-4.19.0-8-amd64-x86_64-with-debian-10.3
[debug] exe versions: ffmpeg 4.1.4-1, ffprobe 4.1.4-1, phantomjs 2.1.1, rtmpdump 2.4
[debug] Default format spec: bestvideo+bestaudio/best
dirkf commented 2 weeks ago

This problem still exists, because the potential filesize is only checked (only known?) for HTTP downloads and not for fragment (DASH, HLS) downloads.

TODO: check how this works in yt-dlp.

dirkf commented 1 week ago

... check how this works in yt-dlp.

The same: https://github.com/yt-dlp/yt-dlp/issues/10663#issuecomment-2393100696