seawolf2357 commited on
Commit
48e40bd
ยท
verified ยท
1 Parent(s): 6daf2cb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -12
app.py CHANGED
@@ -23,24 +23,22 @@ def gradio_fetch_and_parse(url):
23
 
24
  def get_main_content(html_content):
25
  soup = BeautifulSoup(html_content, 'html.parser')
26
- # <meta> ํƒœ๊ทธ์˜ content ์†์„ฑ์„ ์ฐพ์•„ ์ถ”์ถœ
27
- meta_content = []
28
- for meta_tag in soup.find_all('meta'):
29
- content = meta_tag.get('content')
30
- if content:
31
- meta_content.append(content.strip())
32
 
33
- extracted_content = '\n'.join(meta_content)
34
-
35
- if extracted_content:
36
- print("์ถ”์ถœ๋œ ๋ฉ”ํƒ€ ์ฝ˜ํ…์ธ :", extracted_content)
37
- return extracted_content
38
  else:
39
- print("๋ฉ”ํƒ€ ์ฝ˜ํ…์ธ ๋ฅผ ์ฐพ์„ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค.")
40
  return ''
41
 
42
 
43
 
 
44
  def format_script(text):
45
  sentences = text.split('.')
46
  script = ""
 
23
 
24
  def get_main_content(html_content):
25
  soup = BeautifulSoup(html_content, 'html.parser')
26
+ # ํด๋ž˜์Šค๋ช…์ด "a-list-item"์ธ ๋ชจ๋“  <span> ํƒœ๊ทธ๋ฅผ ์ฐพ์Œ
27
+ list_items = soup.find_all('span', class_='a-list-item')
28
+ text = ''
29
+ for item in list_items:
30
+ text += item.get_text(strip=True) + '\n'
 
31
 
32
+ if text:
33
+ print("์ถ”์ถœ๋œ ํ…์ŠคํŠธ:", text)
34
+ return text
 
 
35
  else:
36
+ print("๋ณธ๋ฌธ ์ฝ˜ํ…์ธ ๋ฅผ ์ฐพ์„ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค.")
37
  return ''
38
 
39
 
40
 
41
+
42
  def format_script(text):
43
  sentences = text.split('.')
44
  script = ""