use sleep delay before Invoking downloader #19163

Closed
opened 2026-02-21 10:27:53 -05:00 by deekerman · 8 comments
Owner

Originally created by @bmrz2019 on GitHub (Jan 20, 2020).

  • I'm reporting a feature request
  • I've verified that I'm running youtube-dl version 2020.01.15
  • I've searched the bugtracker for similar feature requests including closed ones

Description

if one uses --sleep-interval 9000 then the command goes to the website, invokes downloader, gathers the 'final URL or similar' and then waits. This is inconvenient:

  • Some websites have timeout for the extracted URL - it becomes invalid before the timeout happens.

  • Download fails

Can you edit code so sleep before doing any network activity

Example

./youtube-dl  -v --sleep-interval  9000  -f '(mp4)[height<480]' --add-metadata   --no-mtime  https://www.youtube.com/watch?v=-nNkqbrL3SE 


[debug] System config: []
[debug] User config: [u'--no-mtime', u'--download-archive', u'~/.youtube-dl-archive', u'-f', u'mp4']
[debug] Custom config: []
[debug] Command-line args: [u'-v', u'--sleep-interval', u'9000', u'-f', u'(mp4)[height<480]', u'--add-metadata', u'--no-mtime', u'https://www.youtube.com/watch?v=-nNkqbrL3SE']
[debug] Encodings: locale ISO-8859-1, fs ISO-8859-1, out ISO-8859-1, pref ISO-8859-1
[debug] youtube-dl version 2020.01.15
[debug] Python version 2.7.15+ (CPython) - Linux-4.15.0-65-generic-x86_64-with-Ubuntu-18.04-bionic
[debug] exe versions: ffmpeg 3.4.6, ffprobe 3.4.6
[debug] Proxy map: {}
[youtube] -nNkqbrL3SE: Downloading webpage
[youtube] -nNkqbrL3SE: Downloading video info webpage
[debug] Invoking downloader on u'https://r1---sn-4g5e6nzl.googlevideo.com/videoplayback?expire=1579557417&ei=yc0lXpu9N4bb1gKklLGYDA&ip=4.4.4.4.&id=o-AKI_x-X7Nye_Lb_Q1KR00uvnz8G_20r7oOkbs_XUT0Gs&itag=18&source=youtube&requiressl=yes&mm=31%2C26&mn=sn-4g5e6nzl%2Csn-h0jeened&ms=au%2Conr&mv=m&mvi=0&pl=17&initcwndbps=1696250&vprv=1&mime=video%2Fmp4&gir=yes&clen=9074296&ratebypass=yes&dur=201.851&lmt=1571923299773668&mt=1579535755&fvip=1&fexp=23842630&beids=9466587&c=WEB&txp=5531432&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cvprv%2Cmime%2Cgir%2Cclen%2Cratebypass%2Cdur%2Clmt&sig=ALgxI2wwRAIgKYkaHvEvx4MXLUN7FYxk_KeyFmbcmK-INvW1g1v9nEUCIFgUU34oDKtVveoS6ol9AnnpSTgIEIZsx04mQEk8CVcS&lsparams=mm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AHylml4wRQIgEyH6OY38x7pkNv6S3HVCvsxrtyjTPhvABTLGLJQikewCIQC-7bgzx9qNNOtmhDYBQyk4PejspOkzkEO4HoJc4x-NdA%3D%3D'
[download] Sleeping 9000 seconds...

For Playlists

I do not know what the optimal solution is:

Originally created by @bmrz2019 on GitHub (Jan 20, 2020). - [X] I'm reporting a feature request - [X] I've verified that I'm running youtube-dl version **2020.01.15** - [X] I've searched the bugtracker for similar feature requests including closed ones ## Description if one uses `--sleep-interval 9000 ` then the command goes to the website, invokes downloader, gathers the 'final **URL** or similar' and then waits. This is inconvenient: - Some websites have timeout for the extracted URL - it becomes invalid before the timeout happens. - Download fails Can you edit code **so sleep before doing any network activity** ## Example ``` ./youtube-dl -v --sleep-interval 9000 -f '(mp4)[height<480]' --add-metadata --no-mtime https://www.youtube.com/watch?v=-nNkqbrL3SE [debug] System config: [] [debug] User config: [u'--no-mtime', u'--download-archive', u'~/.youtube-dl-archive', u'-f', u'mp4'] [debug] Custom config: [] [debug] Command-line args: [u'-v', u'--sleep-interval', u'9000', u'-f', u'(mp4)[height<480]', u'--add-metadata', u'--no-mtime', u'https://www.youtube.com/watch?v=-nNkqbrL3SE'] [debug] Encodings: locale ISO-8859-1, fs ISO-8859-1, out ISO-8859-1, pref ISO-8859-1 [debug] youtube-dl version 2020.01.15 [debug] Python version 2.7.15+ (CPython) - Linux-4.15.0-65-generic-x86_64-with-Ubuntu-18.04-bionic [debug] exe versions: ffmpeg 3.4.6, ffprobe 3.4.6 [debug] Proxy map: {} [youtube] -nNkqbrL3SE: Downloading webpage [youtube] -nNkqbrL3SE: Downloading video info webpage [debug] Invoking downloader on u'https://r1---sn-4g5e6nzl.googlevideo.com/videoplayback?expire=1579557417&ei=yc0lXpu9N4bb1gKklLGYDA&ip=4.4.4.4.&id=o-AKI_x-X7Nye_Lb_Q1KR00uvnz8G_20r7oOkbs_XUT0Gs&itag=18&source=youtube&requiressl=yes&mm=31%2C26&mn=sn-4g5e6nzl%2Csn-h0jeened&ms=au%2Conr&mv=m&mvi=0&pl=17&initcwndbps=1696250&vprv=1&mime=video%2Fmp4&gir=yes&clen=9074296&ratebypass=yes&dur=201.851&lmt=1571923299773668&mt=1579535755&fvip=1&fexp=23842630&beids=9466587&c=WEB&txp=5531432&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cvprv%2Cmime%2Cgir%2Cclen%2Cratebypass%2Cdur%2Clmt&sig=ALgxI2wwRAIgKYkaHvEvx4MXLUN7FYxk_KeyFmbcmK-INvW1g1v9nEUCIFgUU34oDKtVveoS6ol9AnnpSTgIEIZsx04mQEk8CVcS&lsparams=mm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AHylml4wRQIgEyH6OY38x7pkNv6S3HVCvsxrtyjTPhvABTLGLJQikewCIQC-7bgzx9qNNOtmhDYBQyk4PejspOkzkEO4HoJc4x-NdA%3D%3D' [download] Sleeping 9000 seconds... ``` ## For Playlists I do not know what the optimal solution is:
deekerman 2026-02-21 10:27:53 -05:00
  • closed this issue
  • added the
    request
    label
Author
Owner

@faizan2700 commented on GitHub (Jan 21, 2020):

If anyone is not working on this I would like to work on this.

@faizan2700 commented on GitHub (Jan 21, 2020): If anyone is not working on this I would like to work on this.
Author
Owner

@faizan2700 commented on GitHub (Jan 21, 2020):

for a single video if we start sleep(time) before initializing the extractor that would solve the issue but if video url has some other problem like webpage is not extracted correctly we will have to wait for that whatever the sleep time is (because that will be known only after extracting the page).
and for playlist we will first extract the information of webpage of playlist and then for before every video processing we will start sleep(time).
But what is the purpose of the option of sleep interval ? ( is it because youtube or other site will detect a lot of activity and block the program so sleep time prevents site to detect this activity? or something other ?

@faizan2700 commented on GitHub (Jan 21, 2020): for a single video if we start sleep(time) before initializing the extractor that would solve the issue but if video url has some other problem like webpage is not extracted correctly we will have to wait for that whatever the sleep time is (because that will be known only after extracting the page). and for playlist we will first extract the information of webpage of playlist and then for before every video processing we will start sleep(time). But what is the purpose of the option of sleep interval ? ( is it because youtube or other site will detect a lot of activity and block the program so sleep time prevents site to detect this activity? or something other ?
Author
Owner

@bmrz2019 commented on GitHub (Jan 29, 2020):

But what is the purpose of the option of sleep interval ? ( is it because youtube or other site will detect a lot of activity and block the program so sleep time prevents site to detect this activity? or something other ?

  1. a lot of activity and block the program
  2. may be you want to download to start after approximately 5 hours (say when sleeping), because you want to use the bandwidth for something else -like urgent work now.
@bmrz2019 commented on GitHub (Jan 29, 2020): > But what is the purpose of the option of sleep interval ? ( is it because youtube or other site will detect a lot of activity and block the program so sleep time prevents site to detect this activity? or something other ? 1. a lot of activity and block the program 2. may be you want to download to start after approximately 5 hours (say when sleeping), because you want to use the bandwidth for something else -like urgent work now.
Author
Owner

@bmrz2019 commented on GitHub (Feb 24, 2020):

@faizan2700 are you planning to work on this? Thank you

@bmrz2019 commented on GitHub (Feb 24, 2020): @faizan2700 are you planning to work on this? Thank you
Author
Owner

@ke352802081770314 commented on GitHub (Sep 8, 2020):

treble2019, your original example looked like you wanted to achieve objective #2. In that case, you could just sleep 9000; ,/youtube-dl ... couldn't you?
Also, the option's name "sleep-interval" indicates that it is more likely aimed at achieving #1 which cannot be done externally when downloading multiple videos. But sleeping 9000 seconds multiple times betwene several videos isn't probably what you wanted, is it, because the third or forth video would already interfere with your following workday?

@ke352802081770314 commented on GitHub (Sep 8, 2020): treble2019, your original example looked like you wanted to achieve objective #2. In that case, you could just sleep 9000; ,/youtube-dl ... couldn't you? Also, the option's name "sleep-interval" indicates that it is more likely aimed at achieving #1 which cannot be done externally when downloading multiple videos. But sleeping 9000 seconds multiple times betwene several videos isn't probably what you wanted, is it, because the third or forth video would already interfere with your following workday?
Author
Owner

@tsingi commented on GitHub (Feb 23, 2021):

Using UNIX (Linux) the 'at' command would accomplish this.

@tsingi commented on GitHub (Feb 23, 2021): Using UNIX (Linux) the 'at' command would accomplish this.
Author
Owner

@rautamiekka commented on GitHub (Feb 23, 2021):

treble2019, your original example looked like you wanted to achieve objective #2. In that case, you could just sleep 9000; ,/youtube-dl ... couldn't you?
Also, the option's name "sleep-interval" indicates that it is more likely aimed at achieving #1 which cannot be done externally when downloading multiple videos. But sleeping 9000 seconds multiple times betwene several videos isn't probably what you wanted, is it, because the third or forth video would already interfere with your following workday?

Be careful when using the hash with numbers on GitHub.

@rautamiekka commented on GitHub (Feb 23, 2021): > treble2019, your original example looked like you wanted to achieve objective #2. In that case, you could just sleep 9000; ,/youtube-dl ... couldn't you? > Also, the option's name "sleep-interval" indicates that it is more likely aimed at achieving #1 which cannot be done externally when downloading multiple videos. But sleeping 9000 seconds multiple times betwene several videos isn't probably what you wanted, is it, because the third or forth video would already interfere with your following workday? Be careful when using the hash with numbers on GitHub.
Author
Owner

@bmrz2019 commented on GitHub (Feb 28, 2021):

just sleep 9000; ,/youtube-dl ... couldn't you?

Yes. I could. Then why have that option inside youtube-dl?

My case is that one could run

tsp youtube-dl --max-sleep-interval seconds --sleep-interval SECONS url

of course I can write bash script...

@bmrz2019 commented on GitHub (Feb 28, 2021): > just sleep 9000; ,/youtube-dl ... couldn't you? Yes. I could. Then why have that option inside youtube-dl? My case is that one could run tsp youtube-dl --max-sleep-interval seconds --sleep-interval SECONS url of course I can write bash script...
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/youtube-dl-ytdl-org#19163
No description provided.