Omnibus commited on
Commit
7839cc0
·
verified ·
1 Parent(s): b343300

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -11
app.py CHANGED
@@ -10,24 +10,26 @@ PAGE_LINK
10
  """
11
  def load_json(url1="",url2="",url3="",url4=""):
12
  get_url=f'{main_directory}{url1}{url2}{url3}{url4}'
13
- feed1 = requests.get(get_url)
14
  if get_url.endswith('.json"'):
 
15
  return feed1.text
16
 
17
  def make_tree(url1="",url2="",url3="",url4=""):
18
  link_box=[]
19
  html_out=""
20
  get_url=f'{main_directory}{url1}{url2}{url3}{url4}'
21
- feed1 = requests.get(get_url)
22
- spl = feed1.text.split("href=")
23
- for line in spl:
24
- spl2 = line.split(">")[0]
25
- print(spl2)
26
- if spl2.endswith('/"') or spl2.endswith('.json"'):
27
- fin=line.split(">")[0].strip('""')
28
- link_box.append(fin)
29
- #html_out=html_out+html.replace("PAGE_LINK",fin)
30
- return gr.update(choices=[l for l in link_box],interactive=True)
 
31
 
32
  def run():
33
  out=make_tree()
 
10
  """
11
  def load_json(url1="",url2="",url3="",url4=""):
12
  get_url=f'{main_directory}{url1}{url2}{url3}{url4}'
13
+ print(get_url)
14
  if get_url.endswith('.json"'):
15
+ feed1 = requests.get(get_url)
16
  return feed1.text
17
 
18
  def make_tree(url1="",url2="",url3="",url4=""):
19
  link_box=[]
20
  html_out=""
21
  get_url=f'{main_directory}{url1}{url2}{url3}{url4}'
22
+ if not get_url.endswith('.json"'):
23
+ feed1 = requests.get(get_url)
24
+ spl = feed1.text.split("href=")
25
+ for line in spl:
26
+ spl2 = line.split(">")[0]
27
+ print(spl2)
28
+ if spl2.endswith('/"') or spl2.endswith('.json"'):
29
+ fin=line.split(">")[0].strip('""')
30
+ link_box.append(fin)
31
+ #html_out=html_out+html.replace("PAGE_LINK",fin)
32
+ return gr.update(choices=[l for l in link_box],interactive=True)
33
 
34
  def run():
35
  out=make_tree()