This commit is contained in:
@@ -74,19 +74,26 @@ class UniversalParser(BaseParser):
|
||||
if parsed.netloc != base_domain:
|
||||
continue
|
||||
|
||||
print("URL:", abs_url)
|
||||
|
||||
|
||||
if not check_url(abs_url) and wp.check_error_url(abs_url):
|
||||
try:
|
||||
article = Article(abs_url)
|
||||
article.download()
|
||||
article.parse()
|
||||
|
||||
|
||||
print("URL:", abs_url)
|
||||
|
||||
if len(article.text) > 200 and article.publish_date:
|
||||
time_text = article.publish_date.strftime("%Y/%m/%d %H:%M:%S")
|
||||
# Если дата публикации отсутствует - используем текущую
|
||||
if article.publish_date:
|
||||
time_text = article.publish_date.strftime("%Y/%m/%d %H:%M:%S")
|
||||
else:
|
||||
time_text = datetime.now().strftime("%Y/%m/%d %H:%M:%S")
|
||||
print(f"Дата публикации отсутствует, используем текущую: {time_text}")
|
||||
|
||||
response_text = gpt_response_message(str(article.text), self.promt)
|
||||
# print(response_text)
|
||||
print(response_text)
|
||||
if response_text:
|
||||
update_bd_and_create_document(
|
||||
response_text=response_text,
|
||||
|
||||
Reference in New Issue
Block a user