Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -42,8 +42,12 @@ def get_blog_content(link):
|
|
42 |
session = setup_session()
|
43 |
response = session.get(link)
|
44 |
soup = BeautifulSoup(response.text, "html.parser")
|
45 |
-
|
46 |
-
|
|
|
|
|
|
|
|
|
47 |
|
48 |
with gr.Interface(
|
49 |
fn=lambda query: crawl_naver_search_results(generate_naver_search_url(query)),
|
@@ -57,8 +61,8 @@ with gr.Interface(
|
|
57 |
with gr.Interface(
|
58 |
fn=get_blog_content,
|
59 |
inputs=gr.Textbox(label="링크를 입력하세요"),
|
60 |
-
outputs=gr.Textbox(label="블로그
|
61 |
-
title="블로그
|
62 |
-
description="링크를 입력하여 블로그
|
63 |
) as blog_content_interface:
|
64 |
blog_content_interface.launch()
|
|
|
42 |
session = setup_session()
|
43 |
response = session.get(link)
|
44 |
soup = BeautifulSoup(response.text, "html.parser")
|
45 |
+
title = soup.find("div", class_="se-module se-module-text se-title-text")
|
46 |
+
if title:
|
47 |
+
title = title.text.strip()
|
48 |
+
else:
|
49 |
+
title = "제목 없음"
|
50 |
+
return title
|
51 |
|
52 |
with gr.Interface(
|
53 |
fn=lambda query: crawl_naver_search_results(generate_naver_search_url(query)),
|
|
|
61 |
with gr.Interface(
|
62 |
fn=get_blog_content,
|
63 |
inputs=gr.Textbox(label="링크를 입력하세요"),
|
64 |
+
outputs=gr.Textbox(label="블로그 제목"),
|
65 |
+
title="블로그 제목 가져오기",
|
66 |
+
description="링크를 입력하여 블로그 제목을 가져옵니다"
|
67 |
) as blog_content_interface:
|
68 |
blog_content_interface.launch()
|