Spaces:
Sleeping
Sleeping
grapplerulrich
commited on
Commit
·
67c42e7
1
Parent(s):
bfe4194
Check if string is empty
Browse files
beautiful_soup/beautiful_soup.py
CHANGED
@@ -25,6 +25,7 @@ def get_url_content( url ):
|
|
25 |
strings = extract_strings( url )
|
26 |
except Exception as exception:
|
27 |
raise exception
|
|
|
28 |
with open( file_path, 'w' ) as file:
|
29 |
json.dump( strings, file )
|
30 |
|
@@ -150,7 +151,9 @@ def get_tags_text( soup ):
|
|
150 |
if found_text != '':
|
151 |
text.append( found_text )
|
152 |
else :
|
153 |
-
|
|
|
|
|
154 |
return text
|
155 |
|
156 |
def allowed_tags( tag ):
|
|
|
25 |
strings = extract_strings( url )
|
26 |
except Exception as exception:
|
27 |
raise exception
|
28 |
+
|
29 |
with open( file_path, 'w' ) as file:
|
30 |
json.dump( strings, file )
|
31 |
|
|
|
151 |
if found_text != '':
|
152 |
text.append( found_text )
|
153 |
else :
|
154 |
+
found_text = tag.get_text( ' ', strip=True )
|
155 |
+
if found_text != '':
|
156 |
+
text.append( found_text )
|
157 |
return text
|
158 |
|
159 |
def allowed_tags( tag ):
|