From bf7ec03fbf5f3b326169dc52abde8ef936df9b03 Mon Sep 17 00:00:00 2001 From: rofl0r Date: Fri, 29 Mar 2019 23:07:44 +0000 Subject: [PATCH] fetch.py: factor out twice used var --- fetch.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fetch.py b/fetch.py index 9493ce7..8ebdd90 100644 --- a/fetch.py +++ b/fetch.py @@ -108,10 +108,11 @@ def extract_urls(content, urls = None, urignore=None): for a in soup.body.find_all('a'): if not 'rel' in a.attrs or not 'noreferrer' in a.attrs['rel'] or a.attrs['href'] in urls: continue bad = False + href = a.attrs['href'] for i in urignore: - if re.findall(i,a.attrs['href'], re.IGNORECASE): + if re.findall(i, href): bad = True break - if not bad: urls.append(a.attrs['href']) + if not bad: urls.append(href) return urls