mirror of https://github.com/scrapy/scrapy.git
refactored url_has_any_extension function
Co-authored-by: Adrián Chaves <adrian@chaves.io>
This commit is contained in:
parent
5b4b8b6fb1
commit
0905d42e33
|
|
@ -31,7 +31,8 @@ def url_is_from_spider(url, spider):
|
|||
|
||||
def url_has_any_extension(url, extensions):
|
||||
"""Return True if the url ends with one of the extensions provided"""
|
||||
return any(parse_url(url).path.lower().endswith(ext) for ext in extensions)
|
||||
lowercase_path = parse_url(url).path.lower()
|
||||
return any(lowercase_path.endswith(ext) for ext in extensions)
|
||||
|
||||
def parse_url(url, encoding=None):
|
||||
"""Return urlparsed url from the given argument (which could be an already
|
||||
|
|
|
|||
Loading…
Reference in New Issue