diff options
-rwxr-xr-x | dtube/dtube.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/dtube/dtube.py b/dtube/dtube.py index 30d4dc5..52b1c1e 100755 --- a/dtube/dtube.py +++ b/dtube/dtube.py @@ -64,7 +64,7 @@ class He: try: he = HeIPrange(match.group(1), verbose=verbose) except Exception, e: - if str(e) == "Target not found": + if str(e)[:16] == "Target not found": print e print "Trying to get closest range announcements" ip = HeIP(match.group(1).split('/')[0], verbose=verbose) @@ -128,8 +128,9 @@ class He: time.sleep(random.random() * 3) # Forced to be kind if self.verbose and self.html.from_cache: print "Response from cache" - if re.search(r'ERROR: .* Not Found', self.tree.xpath('//title')[0].text): - raise Exception("Target not found") + err = re.search(r'ERROR: (.*) Not Found', self.tree.xpath('//title')[0].text) + if err: + raise Exception("Target not found : %s" % err.group(1)) class HeAS(He): url_prefix = '/AS' |