AIRider commited on
Commit
18844e0
·
verified ·
1 Parent(s): 57f2a47

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -5
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
- content = soup.find("div", class_="se-main-container").text.strip()
46
- return content
 
 
 
 
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()