Omnibus commited on
Commit
9e02324
1 Parent(s): 54d09ea

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -4
app.py CHANGED
@@ -5,8 +5,15 @@ import bs4
5
  import lxml
6
  import json
7
 
8
-
9
-
 
 
 
 
 
 
 
10
 
11
  def get_rss(rss_url):
12
  r = requests.get(f'{rss_url}')
@@ -19,8 +26,12 @@ def get_rss(rss_url):
19
 
20
  with gr.Blocks() as app:
21
  with gr.Row():
22
- inp = gr.Textbox()
23
- btn = gr.Button()
 
 
 
24
  out_json = gr.JSON()
 
25
  btn.click(get_rss,inp,out_json)
26
  app.launch()
 
5
  import lxml
6
  import json
7
 
8
+ def find_rss(rss_url):
9
+ json_box=[]
10
+ json_dict={}
11
+ r = requests.get(f'{rss_url}')
12
+ soup = bs4.BeautifulSoup(source.content,'lxml')
13
+ for i,p in enumerate(soup.find_all("a")):
14
+ json_dict[i]=p
15
+ json_box.append(json_dict)
16
+ return json_box
17
 
18
  def get_rss(rss_url):
19
  r = requests.get(f'{rss_url}')
 
26
 
27
  with gr.Blocks() as app:
28
  with gr.Row():
29
+ rss_search = gr.Textbox(label="search rss (xml,json)")
30
+ search_btn=gr.Button("find rss")
31
+ with gr.Row():
32
+ rss = gr.Textbox(label="rss")
33
+ btn = gr.Button("load rss")
34
  out_json = gr.JSON()
35
+ search_btn.click(find_rss,inp,out_json)
36
  btn.click(get_rss,inp,out_json)
37
  app.launch()