seawolf2357 commited on
Commit
4172426
Β·
verified Β·
1 Parent(s): e420980

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -3
app.py CHANGED
@@ -98,12 +98,20 @@ def format_results(results):
98
  snippet = result.get("snippet", "λ‚΄μš© μ—†μŒ")
99
  source = result.get("source", result.get("channel", "μ•Œ 수 μ—†μŒ"))
100
  date = result.get("date", result.get("time", "μ•Œ 수 μ—†λŠ” μ‹œκ°„"))
101
-
 
 
 
 
 
 
 
102
  article_html = f"""
103
- <div style="margin-bottom: 20px;">
104
  <h3><a href="{link}" target="_blank">{title}</a></h3>
105
- <p>{snippet}</p>
106
  <p><strong>{source}</strong> - {date}</p>
 
 
107
  </div>
108
  """
109
  formatted_articles += article_html
 
98
  snippet = result.get("snippet", "λ‚΄μš© μ—†μŒ")
99
  source = result.get("source", result.get("channel", "μ•Œ 수 μ—†μŒ"))
100
  date = result.get("date", result.get("time", "μ•Œ 수 μ—†λŠ” μ‹œκ°„"))
101
+ image_url = result.get("thumbnail", result.get("img", ""))
102
+
103
+ # 이미지 νƒœκ·Έ 생성
104
+ if image_url:
105
+ image_html = f'<img src="{image_url}" alt="Image" style="max-width: 100%; height: auto;">'
106
+ else:
107
+ image_html = ''
108
+
109
  article_html = f"""
110
+ <div style="margin-bottom: 20px; border-bottom: 1px solid #ccc; padding-bottom: 20px;">
111
  <h3><a href="{link}" target="_blank">{title}</a></h3>
 
112
  <p><strong>{source}</strong> - {date}</p>
113
+ {image_html}
114
+ <p>{snippet}</p>
115
  </div>
116
  """
117
  formatted_articles += article_html