fantaxy commited on
Commit
ea001e6
ยท
verified ยท
1 Parent(s): aa6ae4c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -5
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.escape(blog_content)
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,