From 7e0e6b94c6b60e745fbf52e7ce24b0a01e6e7720 Mon Sep 17 00:00:00 2001 From: admin Date: Thu, 1 Dec 2016 03:35:22 +0000 Subject: [PATCH] =?UTF-8?q?kakaostory=20=EC=98=A4=EC=A0=84=2012:00=20?= =?UTF-8?q?=ED=91=9C=EA=B8=B0=20=EB=AC=B8=EC=A0=9C=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: svn://192.168.0.12/source@327 8346c931-da38-4b9b-9d4c-e48b93cbd075 --- WebBasedCrawler/kakao/kakaocrawl.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/WebBasedCrawler/kakao/kakaocrawl.py b/WebBasedCrawler/kakao/kakaocrawl.py index 3b892b8..05c4497 100644 --- a/WebBasedCrawler/kakao/kakaocrawl.py +++ b/WebBasedCrawler/kakao/kakaocrawl.py @@ -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