This commit is contained in:
@@ -130,7 +130,7 @@ class Source2Parser(BaseParser):
|
|||||||
text, time_text = extract_text_from_url(hrefs)
|
text, time_text = extract_text_from_url(hrefs)
|
||||||
if len(text) >= MIN_ARTICLE_TEXT_LENGTH:
|
if len(text) >= MIN_ARTICLE_TEXT_LENGTH:
|
||||||
response_text = gpt_response_message(text, "source2")
|
response_text = gpt_response_message(text, "source2")
|
||||||
print(response_text)
|
# print(response_text)
|
||||||
if response_text:
|
if response_text:
|
||||||
update_bd_and_create_document(
|
update_bd_and_create_document(
|
||||||
response_text=response_text,
|
response_text=response_text,
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ class UniversalParser(BaseParser):
|
|||||||
if parsed.netloc != base_domain:
|
if parsed.netloc != base_domain:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
print(num)
|
# print(num)
|
||||||
|
|
||||||
if not check_url(abs_url) and wp.check_error_url(abs_url):
|
if not check_url(abs_url) and wp.check_error_url(abs_url):
|
||||||
try:
|
try:
|
||||||
@@ -89,6 +89,7 @@ class UniversalParser(BaseParser):
|
|||||||
# Если дата публикации отсутствует - используем текущую
|
# Если дата публикации отсутствует - используем текущую
|
||||||
if article.publish_date:
|
if article.publish_date:
|
||||||
time_text = article.publish_date.strftime("%Y/%m/%d %H:%M:%S")
|
time_text = article.publish_date.strftime("%Y/%m/%d %H:%M:%S")
|
||||||
|
print(time_text)
|
||||||
else:
|
else:
|
||||||
time_text = datetime.now().strftime("%Y/%m/%d %H:%M:%S")
|
time_text = datetime.now().strftime("%Y/%m/%d %H:%M:%S")
|
||||||
print(f"Дата публикации отсутствует, используем текущую: {time_text}")
|
print(f"Дата публикации отсутствует, используем текущую: {time_text}")
|
||||||
|
|||||||
@@ -59,7 +59,8 @@ def update_bd_and_create_document(
|
|||||||
print("Данные успешно сохранены в БД")
|
print("Данные успешно сохранены в БД")
|
||||||
|
|
||||||
# Создание DOCX документа
|
# Создание DOCX документа
|
||||||
path_day = parsed_at.split()[0].replace('-', '/')
|
# path_day = parsed_at.split()[0].replace('-', '/')
|
||||||
|
path_day = article_date.split()[0]
|
||||||
documents_path = os.path.join(DOCUMENTS_DIR, path_day)
|
documents_path = os.path.join(DOCUMENTS_DIR, path_day)
|
||||||
if not os.path.exists(documents_path):
|
if not os.path.exists(documents_path):
|
||||||
os.makedirs(documents_path)
|
os.makedirs(documents_path)
|
||||||
|
|||||||
Reference in New Issue
Block a user