myagent-ai 1.15.90 → 1.15.91
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/skills/search_skill.py +8 -1
package/package.json
CHANGED
package/skills/search_skill.py
CHANGED
|
@@ -330,8 +330,15 @@ class WebReadSkill(Skill):
|
|
|
330
330
|
for tag in soup(["script", "style", "nav", "footer", "header", "aside"]):
|
|
331
331
|
tag.decompose()
|
|
332
332
|
# 移除所有 class 含特定关键词的元素
|
|
333
|
+
# 注意: decompose() 会连带销毁子元素,子元素的 attrs 变为 None,
|
|
334
|
+
# 因此必须检查 tag.parent 是否为 None 来跳过已被销毁的标签
|
|
333
335
|
for tag in soup.find_all(True, class_=True):
|
|
334
|
-
|
|
336
|
+
if tag.parent is None:
|
|
337
|
+
continue
|
|
338
|
+
try:
|
|
339
|
+
cls_str = " ".join(tag.get("class", []))
|
|
340
|
+
except (AttributeError, TypeError):
|
|
341
|
+
continue
|
|
335
342
|
if any(kw in cls_str.lower() for kw in
|
|
336
343
|
["sidebar", "footer", "nav", "header", "advertisement",
|
|
337
344
|
"cookie", "popup", "modal", "banner", "social", "share"]):
|