From 9afec1a034185dcbfbe25f47198ae6067fae3d40 Mon Sep 17 00:00:00 2001 From: Bernard Cafarelli Date: Thu, 5 Dec 2019 18:22:38 +0100 Subject: [PATCH] More python3 fixes --- pym/euscan/handlers/__init__.py | 2 +- pym/euscan/handlers/freecode.py | 6 +++--- pym/euscan/handlers/generic.py | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pym/euscan/handlers/__init__.py b/pym/euscan/handlers/__init__.py index bdae6f8..8ee02b3 100644 --- a/pym/euscan/handlers/__init__.py +++ b/pym/euscan/handlers/__init__.py @@ -158,7 +158,7 @@ def scan_url(pkg, urls, options, on_progress=None): except Exception as e: output.ewarn( "Handler failed: [%s] %s" % - (e.__class__.__name__, e.message) + (e.__class__.__name__, str(e)) ) if versions and CONFIG['oneshot']: diff --git a/pym/euscan/handlers/freecode.py b/pym/euscan/handlers/freecode.py index b6f5a70..94ec649 100644 --- a/pym/euscan/handlers/freecode.py +++ b/pym/euscan/handlers/freecode.py @@ -22,7 +22,7 @@ def scan_pkg(pkg, options): output.einfo("Using FreeCode handler: " + package) fp = urllib.request.urlopen("http://freecode.com/projects/%s/releases" % package) - content = fp.read() + content = str(fp.read()) result = re.findall( r'([^<]+)' % package, @@ -36,10 +36,10 @@ def scan_pkg(pkg, options): continue fp = urllib.request.urlopen("http://freecode.com/projects/%s/releases/%s" % (package, release_id)) - content = fp.read() + content = str(fp.read()) download_page = re.findall(r']*href", data, re.I): + if re.search(b"<\s*a\s+[^>]*href", data, re.I): results.extend(scan_html(data, url, pattern)) elif url.startswith('ftp://'): results.extend(scan_ftp(data, url, pattern))