Omnibus commited on
Commit
6f2a024
·
verified ·
1 Parent(s): d512f9f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -10
app.py CHANGED
@@ -2,22 +2,28 @@ import gradio as gr
2
  import requests
3
  import json
4
  main_directory = "https://services.swpc.noaa.gov/"
 
 
 
 
 
 
 
 
5
  def run():
6
  link_box=[]
 
7
  feed1 = requests.get(main_directory)
8
- #lines = feed1.text.split("\n")
9
- spl = feed1.text.split("href=")
10
- print(spl)
11
-
12
  for line in spl:
13
  spl2 = line.split(">")[0]
14
  if spl2.endswith('/"'):
15
- link_box.append(line.split(">")[0])
16
- #print(feed1.json.keys())
17
- print("#############")
18
- print(feed1.text)
19
- return link_box
20
  with gr.Blocks() as app:
21
  links=gr.JSON()
22
- app.load(run,None,links)
 
23
  app.launch()
 
2
  import requests
3
  import json
4
  main_directory = "https://services.swpc.noaa.gov/"
5
+
6
+ html = """
7
+ <div>
8
+ <a href="PAGE_LINK">PAGE_LINK</a>
9
+ </div>
10
+ """
11
+
12
+
13
  def run():
14
  link_box=[]
15
+ html_out=""
16
  feed1 = requests.get(main_directory)
 
 
 
 
17
  for line in spl:
18
  spl2 = line.split(">")[0]
19
  if spl2.endswith('/"'):
20
+ fin=line.split(">")[0].strip('""')
21
+ link_box.append(fin)
22
+ html_out=html_out+html.replace("PAGE_LINK",fin)
23
+ return link_box,html_out
24
+
25
  with gr.Blocks() as app:
26
  links=gr.JSON()
27
+ html_=gr.HTML()
28
+ app.load(run,None,[links,html_])
29
  app.launch()