Omnibus commited on
Commit
6660108
1 Parent(s): becd9fd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -15
app.py CHANGED
@@ -3,21 +3,21 @@ import requests
3
  import bs4
4
 
5
  def sitemap(url):
6
- if url != "" and url != None:
7
- out = []
8
- source = requests.get(url)
9
- if source.status_code ==200:
10
- #soup = bs4.BeautifulSoup(source.content,'lxml')
11
- soup = bs4.BeautifulSoup(source.content,'html.parser')
12
-
13
- rawp=(f'RAW TEXT RETURNED: {soup.text}')
14
- cnt=0
15
- cnt+=len(rawp)
16
- out.append(rawp)
17
- out.append("HTML fragments: ")
18
- q=("a","p","span","content","article")
19
- for p in soup.find_all("a"):
20
- out.append({"LINK TITLE":p.get('title'),"URL":p.get('href'),"STRING":p.string})
21
  return out
22
  with gr.Blocks() as app:
23
  inp=gr.Textbox()
 
3
  import bs4
4
 
5
  def sitemap(url):
6
+ if url != "" and url != None:
7
+ out = []
8
+ source = requests.get(url)
9
+ if source.status_code ==200:
10
+ #soup = bs4.BeautifulSoup(source.content,'lxml')
11
+ soup = bs4.BeautifulSoup(source.content,'html.parser')
12
+
13
+ rawp=(f'RAW TEXT RETURNED: {soup.text}')
14
+ cnt=0
15
+ cnt+=len(rawp)
16
+ out.append(rawp)
17
+ out.append("HTML fragments: ")
18
+ q=("a","p","span","content","article")
19
+ for p in soup.find_all("a"):
20
+ out.append({"LINK TITLE":p.get('title'),"URL":p.get('href'),"STRING":p.string})
21
  return out
22
  with gr.Blocks() as app:
23
  inp=gr.Textbox()