浏览代码

[fix] handle single closing element in HTMLTextExtractor

Adam Tauber 10 年前
父节点
当前提交
699fe60e50
共有 1 个文件被更改,包括 4 次插入0 次删除
  1. 4
    0
      searx/utils.py

+ 4
- 0
searx/utils.py 查看文件

82
         self.tags.append(tag)
82
         self.tags.append(tag)
83
 
83
 
84
     def handle_endtag(self, tag):
84
     def handle_endtag(self, tag):
85
+        if not self.tags:
86
+            return
87
+
85
         if tag != self.tags[-1]:
88
         if tag != self.tags[-1]:
86
             raise Exception("invalid html")
89
             raise Exception("invalid html")
90
+
87
         self.tags.pop()
91
         self.tags.pop()
88
 
92
 
89
     def is_valid_tag(self):
93
     def is_valid_tag(self):