diff --git a/ox/imdb.py b/ox/imdb.py index d776095..e43d7ee 100644 --- a/ox/imdb.py +++ b/ox/imdb.py @@ -313,23 +313,35 @@ def getMovieReleaseDate(imdbId): first_release = r[1] return first_release +def _parseDate(d): + try: + parsed_date = time.strptime(d, "%d %B %Y") + parsed_date = time.strftime('%Y-%m-%d', parsed_date) + return parsed_date + except: + try: + parsed_date = time.strptime(d, "%B %Y") + parsed_date = time.strftime('%Y-%m-01', parsed_date) + return parsed_date + except: + pass + try: + parsed_date = time.strptime(d, "%Y") + parsed_date = time.strftime('%Y-01-01', parsed_date) + return parsed_date + except: + pass + return d + def getMovieReleaseDates(imdbId): url = "%s/releaseinfo" % getUrlBase(imdbId) data = getUrlUnicode(url) releasedates = [] regexp = '''