From bfbeb00e0c9f7310826f3771d20c736fcdd066bf Mon Sep 17 00:00:00 2001 From: john Date: Sat, 8 Sep 2018 15:10:00 -0700 Subject: [PATCH] Added date bugfix --- youtube_dl/extractor/niconico.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/youtube_dl/extractor/niconico.py b/youtube_dl/extractor/niconico.py index fce5755de..0ad6479b1 100644 --- a/youtube_dl/extractor/niconico.py +++ b/youtube_dl/extractor/niconico.py @@ -484,7 +484,6 @@ class NicovideoIE(SearchInfoExtractor): while True: search_url = "http://www.nicovideo.jp/search/%s?sort=f&order=d" % (query) - print(search_url) r = self._get_entries_for_date(search_url, query, currDate) # did we gather more entries in the last few pages than were asked for? If so, only add as many as are needed to reach the desired number. @@ -495,7 +494,7 @@ class NicovideoIE(SearchInfoExtractor): # is a guarantee that the number of pages in the search results will not exceed 50. For any given search for a day, we extract everything available, and move on, until # finding as many entries as were requested. currDate -= datetime.timedelta(days=1) - if(len(entries) >= n): + if(len(entries) >= n or currDate < datetime.datetime(2007, 1, 1)): break return { @@ -506,7 +505,7 @@ class NicovideoIE(SearchInfoExtractor): def _get_entries_for_date(self, url, query, date, pageNumber=1): link = url + "&page=" + str(pageNumber) + "&start=" + str(date) + "&end=" + str(date) - results = self._download_webpage(link, query, note='Downloading results page %s for date %s' % (pageNumber, date)) + results = self._download_webpage(link, query, note='Extracting results from page %s for date %s' % (pageNumber, date)) entries = [] r = re.findall(r''') data-video-id=['|"](..[0-9]{1,8})''', results)