Omnibus commited on
Commit
43954cf
1 Parent(s): e832cec

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -3
app.py CHANGED
@@ -20,8 +20,14 @@ def find_all(url,q=None,num=None):
20
  print(soup.p)
21
  print(soup.find_all('p'))
22
  for tag in soup.find_all():
23
- rawp.append(tag.name)
24
- rawp.append(tag.string)
 
 
 
 
 
 
25
  for url in soup.find_all('a'):
26
  print(url.get('href'))
27
 
@@ -36,7 +42,7 @@ def find_it(url,q=None,num=None):
36
  source = urllib.request.urlopen(url).read()
37
  soup = bs4.BeautifulSoup(source,'lxml')
38
  for p in soup.find_all(f'{q}'):
39
- out.append(p)
40
  out.append(p.string)
41
  out.append(p.parent)
42
 
 
20
  print(soup.p)
21
  print(soup.find_all('p'))
22
  for tag in soup.find_all():
23
+ try:
24
+ n = url.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'):
32
  print(url.get('href'))
33
 
 
42
  source = urllib.request.urlopen(url).read()
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)
48