Omnibus commited on
Commit
3381f0b
1 Parent(s): 0052369

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -23,10 +23,14 @@ def find_all(url,q=None,num=None):
23
 
24
  def find_it(url,q=None,num=None):
25
  out = []
 
26
  source = urllib.request.urlopen(url).read()
27
  soup = bs4.BeautifulSoup(source,'lxml')
28
 
29
  for p in soup.find_all(f'{q}'):
 
 
 
30
  try:
31
  test = soup.select(f'{p.name}:first-child')
32
 
@@ -60,7 +64,7 @@ with gr.Blocks() as app:
60
  with gr.Row():
61
  inp = gr.Textbox()
62
  q = gr.Textbox(value="p")
63
- num = gr.Number(value=1)
64
  with gr.Row():
65
  all_btn = gr.Button("Load")
66
  find_btn = gr.Button("Find")
 
23
 
24
  def find_it(url,q=None,num=None):
25
  out = []
26
+
27
  source = urllib.request.urlopen(url).read()
28
  soup = bs4.BeautifulSoup(source,'lxml')
29
 
30
  for p in soup.find_all(f'{q}'):
31
+ if num != "":
32
+ p=p.get(f'{num}')
33
+
34
  try:
35
  test = soup.select(f'{p.name}:first-child')
36
 
 
64
  with gr.Row():
65
  inp = gr.Textbox()
66
  q = gr.Textbox(value="p")
67
+ num = gr.Textbox()
68
  with gr.Row():
69
  all_btn = gr.Button("Load")
70
  find_btn = gr.Button("Find")