requirements.txt 추가 및 lib.py > common.py 수정과 리팩토링

This commit is contained in:
2025-07-14 13:14:38 +09:00
parent e396c08f6b
commit 72a12ac29f
4 changed files with 15 additions and 8 deletions

View File

@ -14,7 +14,7 @@ from conf.config import (
MESSAGE_PLATFORMS, MATTERMOST_URL, MATTERMOST_BOT_TOKEN, MATTERMOST_CHANNEL_ID
)
from lib.send_message import MessageSender
from lib.lib import (
from lib.common import (
create_mobile_driver,
save_cookies,
load_cookies,
@ -92,11 +92,13 @@ class NaverReviewCollector:
for i in range(4, 7):
try:
el = li.find_element(By.XPATH, f"./div[{i}]/a")
if el and el.text.strip():
return clean_html_text(el.get_attribute("innerHTML"))
if el:
text = el.text.strip()
return clean_html_text(el.get_attribute("innerHTML")) if text else "내용 없음"
except Exception:
continue
return None
return "내용 없음"
def extract_reviews(self):
reviews = []
@ -132,8 +134,8 @@ class NaverReviewCollector:
continue
text = self.extract_review_text(li)
if not text:
continue
#if not text:
# continue
reviews.append({
"작성자": author,
@ -248,6 +250,7 @@ class NaverReviewCollector:
mattermost_token=MATTERMOST_BOT_TOKEN,
mattermost_channel_id=MATTERMOST_CHANNEL_ID,
)
send_failure_message(sender, MESSAGE_PLATFORMS)
else:
self.send_to_message()

View File

@ -12,7 +12,7 @@ from conf.config import (
MESSAGE_PLATFORMS, MATTERMOST_URL, MATTERMOST_BOT_TOKEN, MATTERMOST_CHANNEL_ID
)
from lib.send_message import MessageSender
from lib.lib import (
from lib.common import (
create_mobile_driver,
get_start_end_dates,
parse_korean_date,

4
requirements.txt Normal file
View File

@ -0,0 +1,4 @@
selenium
requests
undetected_chromedriver
dotenv