diff --git a/r2/r2/lib/scraper.py b/r2/r2/lib/scraper.py index acaa3d027..c10eef72d 100644 --- a/r2/r2/lib/scraper.py +++ b/r2/r2/lib/scraper.py @@ -96,7 +96,7 @@ def fetch_url(url, referer = None, retries = 1, dimension = False): nothing = None if dimension else (None, None) url = clean_url(url) #just basic urls - if not (url.startswith('http://') or url.startswith('https://')): + if not url.startswith(('http://', 'https://')): return nothing while True: try: diff --git a/r2/r2/lib/template_helpers.py b/r2/r2/lib/template_helpers.py index e63577c40..9f60032eb 100755 --- a/r2/r2/lib/template_helpers.py +++ b/r2/r2/lib/template_helpers.py @@ -378,7 +378,7 @@ def add_sr(path, sr_path = True, nocname=False, force_hostname = False, retain_e c.cname, c.render_style, c.site.name """ # don't do anything if it is just an anchor - if path.startswith('#') or path.startswith('javascript:'): + if path.startswith(('#', 'javascript:')): return path u = UrlParser(path) diff --git a/r2/r2/lib/utils/utils.py b/r2/r2/lib/utils/utils.py index 750f54b6d..481a7cfe9 100644 --- a/r2/r2/lib/utils/utils.py +++ b/r2/r2/lib/utils/utils.py @@ -251,7 +251,7 @@ def path_component(s): def get_title(url): """Fetches the contents of url and extracts (and utf-8 encodes) the contents of