diff options
-rw-r--r-- | releng/management/commands/syncisos.py | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/releng/management/commands/syncisos.py b/releng/management/commands/syncisos.py index f182cc33..060ab2c1 100644 --- a/releng/management/commands/syncisos.py +++ b/releng/management/commands/syncisos.py @@ -14,14 +14,17 @@ class IsoListParser(HTMLParser): HTMLParser.__init__(self) self.hyperlinks = [] - self.url_re = re.compile('(?!\.{2})/$') def handle_starttag(self, tag, attrs): - if tag == 'a': - for name, value in attrs: - if name == "href": - if value != '../' and self.url_re.search(value) is not None: - self.hyperlinks.append(value[:-1]) + if tag != 'a': + return + + for name, value in attrs: + if name != "href": + continue + + if value.endswith('/') and value != '../' and '/' not in value[:-1] and len(value[:-1]) > 0: + self.hyperlinks.append(value[:-1]) def parse(self, url): try: |