Skip to content

Scrapy, a fast high-level web crawling & scraping framework for Python.

BaseSgmlLinkExtractor: Fixed unknown_endtag() so that it only set current_link=None when the end tag match the opening tag

Benoit Blanchon62f717194251
diff --git a/scrapy/contrib/linkextractors/sgml.py b/scrapy/contrib/linkextractors/sgml.py
index d8f6ae4ec..bc8447529 100644
--- a/scrapy/contrib/linkextractors/sgml.py
+++ b/scrapy/contrib/linkextractors/sgml.py
@@ -74,7 +74,8 @@ class BaseSgmlLinkExtractor(FixedSGMLParser):
self.current_link = link
def unknown_endtag(self, tag):
- self.current_link = None
+ if self.scan_tag(tag):
+ self.current_link = None
def handle_data(self, data):
if self.current_link: