Skip to content

Instantly share code, notes, and snippets.

@phihag
Last active November 28, 2018 02:30
Show Gist options
  • Save phihag/083275da78c38354a1ccb100f8eecb84 to your computer and use it in GitHub Desktop.
Save phihag/083275da78c38354a1ccb100f8eecb84 to your computer and use it in GitHub Desktop.
youtube-dl daterange simplified
from __future__ import unicode_literals
import youtube_dl
from youtube_dl.utils import DateRange
ydl_opts = {
'daterange' : DateRange('20180601'),
}
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
ydl.download(['MqpVnYrNnf0'])
@durai23
Copy link

durai23 commented Nov 28, 2018

Hi, there is an error with the latest version of youtube-dl. It is interpreting the input date-range as a date to be compared to. This is the output I get with the current version FOR THE ABOVE CODE.

durai@durai-vm:~/shared_synapse$ python 2date_range_test.py
[debug] Encodings: locale UTF-8, fs UTF-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2018.11.23
[debug] Python version 2.7.15rc1 (CPython) - Linux-4.15.0-29-generic-x86_64-with-Ubuntu-18.04-bionic
[debug] exe versions: none
[debug] Proxy map: {}
[youtube] MqpVnYrNnf0: Downloading webpage
[youtube] MqpVnYrNnf0: Downloading video info webpage
[debug] Default format spec: best/bestvideo+bestaudio
[download] 2015-07-31 upload date is not in range 2018-06-01 - 9999-12-31

BUT if you supply date as '20150731' i.e. the exact upload date then it works -

durai@durai-vm:~/shared_synapse$ python 2date_range_test.py
[debug] Encodings: locale UTF-8, fs UTF-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2018.11.23
[debug] Python version 2.7.15rc1 (CPython) - Linux-4.15.0-29-generic-x86_64-with-Ubuntu-18.04-bionic
[debug] exe versions: none
[debug] Proxy map: {}
[youtube] MqpVnYrNnf0: Downloading webpage
[youtube] MqpVnYrNnf0: Downloading video info webpage
[debug] Default format spec: bestvideo+bestaudio/best
Dungeons and Dragons Lore: The Beholder

Do you know what is going on?

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