You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
def url_is_from_any_domain(url, domains):
"""Return True if the url belongs to any of the given domains"""
"""Reference: https://github.com/scrapy/scrapy/blob/7e8453cf1ec992e5df5cebfeda08552c58e7c9bc/scrapy/utils/url.py#L28"""
host = parse_url(url).netloc.lower()
if not host:
return False
domains = [d.lower() for d in domains]
return any((host == d) or (host.endswith('.%s' % d)) for d in domains)
def url_is_from_a_spider(url, spider):
"""Return True if the url belongs to the given spider"""
return url_is_from_any_domain(url,
[spider.name] + list(getattr(spider, 'allowed_domains', [])))
The text was updated successfully, but these errors were encountered:
The text was updated successfully, but these errors were encountered: