Update app.py
Browse files
app.py
CHANGED
@@ -632,6 +632,7 @@ def process_all_titles(category, style, topic, num_titles):
|
|
632 |
for title in titles[:num_titles]:
|
633 |
try:
|
634 |
|
|
|
635 |
# ์ฒซ ๋ฒ์งธ ์ด๋ฏธ์ง URL ๊ฐ์ ธ์ค๊ธฐ
|
636 |
image_url_1 = get_image_url(topic)
|
637 |
|
@@ -645,16 +646,17 @@ def process_all_titles(category, style, topic, num_titles):
|
|
645 |
results.append(f"์ ๋ชฉ: {title}\n์์ฑ ์คํจ: {blog_content}\n\n")
|
646 |
continue
|
647 |
|
648 |
-
# ์ฒซ ๋ฒ์งธ ์ด๋ฏธ์ง URL์ ๋ธ๋ก๊ทธ ๋ด์ฉ ์์ ๋ถ๋ถ์ ์ถ๊ฐ
|
649 |
if image_url_1:
|
650 |
img_tag_1 = f'<img src="{image_url_1}" alt="{topic} 1" style="max-width:100%; height:auto;">'
|
651 |
blog_content = f'{img_tag_1}\n\n{blog_content}'
|
652 |
-
|
653 |
# ๋ ๋ฒ์งธ ์ด๋ฏธ์ง URL์ ๋ธ๋ก๊ทธ ๋ด์ฉ ๋ ๋ถ๋ถ์ ์ถ๊ฐ
|
654 |
if image_url_2:
|
655 |
img_tag_2 = f'<img src="{image_url_2}" alt="{topic} 2" style="max-width:100%; height:auto;">'
|
656 |
blog_content = f'{blog_content}\n\n{img_tag_2}'
|
657 |
|
|
|
|
|
658 |
# ํฌ์คํ
์ ์ก
|
659 |
send_result = send_to_blogger(title, blog_content)
|
660 |
|
@@ -667,13 +669,15 @@ def process_all_titles(category, style, topic, num_titles):
|
|
667 |
|
668 |
return "\n".join(results)
|
669 |
|
|
|
|
|
670 |
def send_to_blogger(blog_title, blog_content):
|
671 |
if not WEBHOOK_URL:
|
672 |
logger.error("WEBHOOK_URL์ด ์ค์ ๋์ง ์์์ต๋๋ค.")
|
673 |
return "WEBHOOK_URL์ด ์ค์ ๋์ง ์์ ํฌ์คํ
์ ์ ์กํ ์ ์์ต๋๋ค."
|
674 |
-
|
675 |
-
# HTML
|
676 |
-
blog_content = html.
|
677 |
|
678 |
payload = {
|
679 |
"blogger_id": BLOGGER_ID,
|
|
|
632 |
for title in titles[:num_titles]:
|
633 |
try:
|
634 |
|
635 |
+
|
636 |
# ์ฒซ ๋ฒ์งธ ์ด๋ฏธ์ง URL ๊ฐ์ ธ์ค๊ธฐ
|
637 |
image_url_1 = get_image_url(topic)
|
638 |
|
|
|
646 |
results.append(f"์ ๋ชฉ: {title}\n์์ฑ ์คํจ: {blog_content}\n\n")
|
647 |
continue
|
648 |
|
|
|
649 |
if image_url_1:
|
650 |
img_tag_1 = f'<img src="{image_url_1}" alt="{topic} 1" style="max-width:100%; height:auto;">'
|
651 |
blog_content = f'{img_tag_1}\n\n{blog_content}'
|
652 |
+
|
653 |
# ๋ ๋ฒ์งธ ์ด๋ฏธ์ง URL์ ๋ธ๋ก๊ทธ ๋ด์ฉ ๋ ๋ถ๋ถ์ ์ถ๊ฐ
|
654 |
if image_url_2:
|
655 |
img_tag_2 = f'<img src="{image_url_2}" alt="{topic} 2" style="max-width:100%; height:auto;">'
|
656 |
blog_content = f'{blog_content}\n\n{img_tag_2}'
|
657 |
|
658 |
+
|
659 |
+
|
660 |
# ํฌ์คํ
์ ์ก
|
661 |
send_result = send_to_blogger(title, blog_content)
|
662 |
|
|
|
669 |
|
670 |
return "\n".join(results)
|
671 |
|
672 |
+
import html
|
673 |
+
|
674 |
def send_to_blogger(blog_title, blog_content):
|
675 |
if not WEBHOOK_URL:
|
676 |
logger.error("WEBHOOK_URL์ด ์ค์ ๋์ง ์์์ต๋๋ค.")
|
677 |
return "WEBHOOK_URL์ด ์ค์ ๋์ง ์์ ํฌ์คํ
์ ์ ์กํ ์ ์์ต๋๋ค."
|
678 |
+
|
679 |
+
# HTML ์ํฐํฐ ๋์ฝ๋ฉ
|
680 |
+
blog_content = html.unescape(blog_content)
|
681 |
|
682 |
payload = {
|
683 |
"blogger_id": BLOGGER_ID,
|