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

[Noco] invalid date format (year=999 / day is out of range for month) #5826

Closed
mitsukarenai opened this issue May 26, 2015 · 3 comments
Closed

[Noco] invalid date format (year=999 / day is out of range for month) #5826

mitsukarenai opened this issue May 26, 2015 · 3 comments

Comments

@mitsukarenai
Copy link

@mitsukarenai mitsukarenai commented May 26, 2015

Happens on some, older, videos: youtube-dl fails to download and outputs:
ValueError: year=999 is before 1900; the datetime strftime() methods require year >= 1900
Error is slightly different with Python3:
ValueError: day is out of range for month

Metadata on Noco may be incomplete or faulty, requires youtube-dl a workaround (ignoring date information from the JSON if invalid ?). May not be easy to reproduce and debug since Noco requires subscription, and browsing the oldest videos from NolifeTV (like "Hidden Palace" 01, 02, 03..).

Full output, Python2 on Ubuntu:

[debug] System config: []
[debug] User config: []
[debug] Command-line args: [u'-u', u'PRIVATE', u'-p', u'PRIVATE', u'-v', u'http://noco.tv/emission/4274/nolife/hall-of-shame/04']
[debug] Encodings: locale ANSI_X3.4-1968, fs ANSI_X3.4-1968, out ANSI_X3.4-1968, pref ANSI_X3.4-1968
[debug] youtube-dl version 2015.05.20
[debug] Python version 2.7.9 - Linux-3.10.23-xxxx-std-ipv6-64-x86_64-with-Ubuntu-15.04-vivid
[debug] exe versions: rtmpdump 2.4
[debug] Proxy map: {}
[Noco] Logging in as *********
[Noco] 4274: Downloading video JSON
[Noco] 4274: Downloading show JSON
[Noco] 4274: Downloading user options JSON
[Noco] 4274: Downloading qualities JSON
[Noco] 4274: Downloading audio-fr_sub-none_HQ video JSON
[Noco] 4274: Downloading audio-fr_sub-none_LQ video JSON
Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/usr/local/bin/youtube-dl/__main__.py", line 19, in <module>
  File "/usr/local/bin/youtube-dl/youtube_dl/__init__.py", line 405, in main
  File "/usr/local/bin/youtube-dl/youtube_dl/__init__.py", line 395, in _real_main
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 1486, in download
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 660, in extract_info
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 706, in process_ie_result
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 1023, in process_video_result
ValueError: year=999 is before 1900; the datetime strftime() methods require year >= 1900

Full output, Python3 on Arch:

[debug] System config: []
[debug] User config: []
[debug] Command-line args: ['-u', 'PRIVATE', '-p', 'PRIVATE', '-v', 'http://noco.tv/emission/4274/nolife/hall-of-shame/04']
[debug] Encodings: locale UTF-8, fs utf-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2015.05.15
[debug] Python version 3.4.3 - Linux-4.0.4-2-ARCH-x86_64-with-arch
[debug] exe versions: ffmpeg 2.6.3, ffprobe 2.6.3, rtmpdump 2.4
[debug] Proxy map: {}
[Noco] Logging in as ********
[Noco] 4274: Downloading video JSON
[Noco] 4274: Downloading show JSON
[Noco] 4274: Downloading user options JSON
[Noco] 4274: Downloading qualities JSON
[Noco] 4274: Downloading audio-fr_sub-none_LQ video JSON
[Noco] 4274: Downloading audio-fr_sub-none_HQ video JSON
Traceback (most recent call last):
  File "/usr/bin/youtube-dl", line 9, in <module>
    load_entry_point('youtube-dl==2015.5.15', 'console_scripts', 'youtube-dl')()
  File "/usr/lib/python3.4/site-packages/youtube_dl/__init__.py", line 405, in main
    _real_main(argv)
  File "/usr/lib/python3.4/site-packages/youtube_dl/__init__.py", line 395, in _real_main
    retcode = ydl.download(all_urls)
  File "/usr/lib/python3.4/site-packages/youtube_dl/YoutubeDL.py", line 1484, in download
    res = self.extract_info(url)
  File "/usr/lib/python3.4/site-packages/youtube_dl/YoutubeDL.py", line 660, in extract_info
    return self.process_ie_result(ie_result, download, extra_info)
  File "/usr/lib/python3.4/site-packages/youtube_dl/YoutubeDL.py", line 706, in process_ie_result
    return self.process_video_result(ie_result, download=download)
  File "/usr/lib/python3.4/site-packages/youtube_dl/YoutubeDL.py", line 1155, in process_video_result
    self.process_info(new_info)
  File "/usr/lib/python3.4/site-packages/youtube_dl/YoutubeDL.py", line 1226, in process_info
    reason = self._match_entry(info_dict, incomplete=False)
  File "/usr/lib/python3.4/site-packages/youtube_dl/YoutubeDL.py", line 597, in _match_entry
    if date not in dateRange:
  File "/usr/lib/python3.4/site-packages/youtube_dl/utils.py", line 884, in __contains__
    date = date_from_str(date)
  File "/usr/lib/python3.4/site-packages/youtube_dl/utils.py", line 847, in date_from_str
    return datetime.datetime.strptime(date_str, "%Y%m%d").date()
  File "/usr/lib/python3.4/_strptime.py", line 500, in _strptime_datetime
    tt, fraction = _strptime(data_string, format)
  File "/usr/lib/python3.4/_strptime.py", line 465, in _strptime
    datetime_date(year, 1, 1).toordinal() + 1
ValueError: day is out of range for month
@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented May 27, 2015

Could you add the --write-pages option and upload/paste all *.dump files?

@mitsukarenai
Copy link
Author

@mitsukarenai mitsukarenai commented May 27, 2015

Sure. It resulted in 7 .dump files. One of them has 3 interesting JSON elements:
"online_date_start_utc":"0999-12-31 23:00:00","online_date_end_utc":"2999-12-31 23:00:00"
"user_free_start_utc":"0999-12-31 23:00:00","user_free_end_utc":"2042-04-01 22:00:00"
"guest_free_start_utc":"0999-12-31 23:00:00","guest_free_end_utc":"2008-10-29 17:33:53"

Indeed, 0999 is before UNIX epoch. Here the dumps:

https://gist.github.com/mitsukarenai/c5c2ac2c307b1a2f24da

@yan12125 yan12125 closed this in 01e21b8 Jun 8, 2015
@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Jun 8, 2015

Sorry for the delay. Currently I simply ignore invalid date. If you have a method to get the correct date of this video, feel free to open a new issue.

@dstftw From the git log the original Noco extractor is written by you. Could you have a look?

dstftw added a commit that referenced this issue Jun 8, 2015
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
2 participants
You can’t perform that action at this time.