Omnibus commited on
Commit
8eb0cc4
1 Parent(s): 4722975

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -22,10 +22,10 @@ def find_all(url,q=None,num=None):
22
  for tag in soup.find_all():
23
  try:
24
  n = tag.get(tag.string)
25
- rawp.append(f'{tag.name}:{tag.string}[{n}]')
26
  except Exception as e:
27
  print (e)
28
- rawp.append(f'{tag.name}:{tag.string}')
29
 
30
  #rawp.append(tag.string)
31
  for url in soup.find_all('a'):
@@ -43,8 +43,8 @@ def find_it(url,q=None,num=None):
43
  soup = bs4.BeautifulSoup(source,'lxml')
44
  for p in soup.find_all(f'{q}'):
45
  #out.append(p)
46
- out.append(p.string)
47
- out.append(p.parent.name)
48
 
49
  for url in soup.find_all('a'):
50
  print(url.get('href'))
 
22
  for tag in soup.find_all():
23
  try:
24
  n = tag.get(tag.string)
25
+ rawp.append({tag.name:tag.string,"parent":tag.parent.name,"children":tag.children.name})
26
  except Exception as e:
27
  print (e)
28
+ rawp.append({tag.name:tag.string})
29
 
30
  #rawp.append(tag.string)
31
  for url in soup.find_all('a'):
 
43
  soup = bs4.BeautifulSoup(source,'lxml')
44
  for p in soup.find_all(f'{q}'):
45
  #out.append(p)
46
+ out.append({q:p.string,"parent":p.parent.name})
47
+ #out.append(p.parent.name)
48
 
49
  for url in soup.find_all('a'):
50
  print(url.get('href'))