def parse_url(self, url):
with self.downloader.request(url) as r:
- for line in r:
+ for i, line in enumerate(r):
+ # Skip the first line
+ if i == 0:
+ continue
+
self.parse_line(line)
def parse_line(self, line):
+ # Skip comments
+ if line.startswith("#"):
+ return
+
try:
lacnic, country_code, type, line = line.split("|", 3)
except:
logging.warning("Could not parse line: %s" % line)
return
- # Skip any lines with addresses that are not allocated
- if not "|allocated|" in line and not "|assigned|" in line:
+ # Skip any lines that are for stats only
+ if country_code == "*":
return
if type in ("ipv6", "ipv4"):