From 68c15713cfc7740a5b047440c57ba4fb3891a403 Mon Sep 17 00:00:00 2001 From: Laurent Ghigonis Date: Sun, 10 Mar 2013 00:32:59 +0100 Subject: dtube: handle IP DNS with empty PTR --- dtube/dtube.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'dtube') diff --git a/dtube/dtube.py b/dtube/dtube.py index 1cab0db..61ca79d 100755 --- a/dtube/dtube.py +++ b/dtube/dtube.py @@ -217,8 +217,8 @@ class HeIP(He): # DNS dns_it = self.tree.xpath('//div[@id="dns"]')[0] self.dns = dict() - self.dns["PTR"] = dns_it.xpath('a[position()=1]/child::text()')[0] - self.dns["PTR_href"] = dns_it.xpath('a[position()=1]')[0].get('href') + self.dns["PTR"] = dns_it.xpath('a[position()=1]/child::text()')[0] if len(dns_it.xpath('a[position()=1]/child::text()')) > 0 else "" + self.dns["PTR_href"] = dns_it.xpath('a[position()=1]')[0].get('href') if len(dns_it.xpath('a[position()=1]')) > 0 else "" self.dns["A_list"] = dns_it.xpath('a[position()>1]/child::text()') self.dns["A_href_list"] = [a.get('href') for a in dns_it.xpath('a[position()>1]')] self.dns_txt = "%s\n" % self.dns["PTR"] -- cgit v1.2.3-59-g8ed1b