Spaces:
Runtime error
Runtime error
philipp-zettl
commited on
Commit
•
db59f68
1
Parent(s):
5fce8f8
fix incorrect BS usage
Browse files- src/text.py +4 -7
src/text.py
CHANGED
@@ -74,16 +74,13 @@ def extract_article(url):
|
|
74 |
|
75 |
def select_content(html_code, elem_class, class_name):
|
76 |
print(f'Calling select_content with {elem_class}, {class_name}')
|
|
|
77 |
if class_name.startswith('.'):
|
78 |
class_name = class_name[1:]
|
79 |
-
|
80 |
elif class_name.startswith('#'):
|
81 |
-
|
82 |
-
|
83 |
-
else:
|
84 |
-
elem_id = None
|
85 |
-
class_name = None
|
86 |
-
return md(str(BS(html_code, features="lxml").find(elem_class, class_=class_name, id=elem_id)))
|
87 |
|
88 |
|
89 |
def split_by_heading(html_content, _i):
|
|
|
74 |
|
75 |
def select_content(html_code, elem_class, class_name):
|
76 |
print(f'Calling select_content with {elem_class}, {class_name}')
|
77 |
+
kwargs = {}
|
78 |
if class_name.startswith('.'):
|
79 |
class_name = class_name[1:]
|
80 |
+
kwargs = {'class_': class_name}
|
81 |
elif class_name.startswith('#'):
|
82 |
+
kwargs = {'id': class_name[1:]}
|
83 |
+
return md(str(BS(article.html, features="lxml").find(**kwargs)))
|
|
|
|
|
|
|
|
|
84 |
|
85 |
|
86 |
def split_by_heading(html_content, _i):
|