kakaostory 오전 12:00 표기 문제 해결
git-svn-id: svn://192.168.0.12/source@327 8346c931-da38-4b9b-9d4c-e48b93cbd075
This commit is contained in:
@@ -61,6 +61,9 @@ def get_date(element):
|
||||
if m.group(4) == "오후" and int(m.group(5)) < 12:
|
||||
temp_date += datetime.timedelta(hours=12)
|
||||
|
||||
if m.group(4) == "오전" and int(m.group(5)) == 12:
|
||||
temp_date -= datetime.timedelta(hours=12)
|
||||
|
||||
# convert datetime.datetime to str
|
||||
return str(temp_date)
|
||||
# return invalid date instead of exception
|
||||
@@ -186,6 +189,10 @@ class BodyCrawler(object):
|
||||
if m.group(4) == "오후" and int(m.group(5)) < 12:
|
||||
temp_date += datetime.timedelta(hours=12)
|
||||
|
||||
# sub 12 hour when the article is written at 12 a.m
|
||||
if m.group(4) == "오전" and int(m.group(5)) == 12:
|
||||
temp_date -= datetime.timedelta(hours=12)
|
||||
|
||||
# convert datetime.datetime to str
|
||||
return str(temp_date)
|
||||
else:
|
||||
@@ -224,6 +231,10 @@ class BodyCrawler(object):
|
||||
if m.group(4) == "오후" and int(m.group(5)) < 12:
|
||||
temp_date += datetime.timedelta(hours=12)
|
||||
|
||||
# sub 12 hour when the article is written at 12 a.m
|
||||
if m.group(4) == "오전" and int(m.group(5)) == 12:
|
||||
temp_date -= datetime.timedelta(hours=12)
|
||||
|
||||
# convert datetime.datetime to str
|
||||
return str(temp_date)
|
||||
# return invalid date instead of exception
|
||||
|
||||
Reference in New Issue
Block a user