aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xdtube/dtube.py4
1 files changed, 2 insertions, 2 deletions
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"]