Return True if the url belongs to any of the given domains
(url: UrlT, domains: Iterable[str])
| 20 | |
| 21 | |
| 22 | def url_is_from_any_domain(url: UrlT, domains: Iterable[str]) -> bool: |
| 23 | """Return True if the url belongs to any of the given domains""" |
| 24 | host = parse_url(url).netloc.lower() |
| 25 | if not host: |
| 26 | return False |
| 27 | return any((host == d) or (host.endswith(f".{d}")) for d in map(str.lower, domains)) |
| 28 | |
| 29 | |
| 30 | def _spider_domains(spider: type[Spider]) -> Iterable[str]: |
no outgoing calls