Allow up to 3 redirects

main
Elbert Alias 3 years ago
parent cb13cd2133
commit 024f50531a

@ -684,11 +684,12 @@ class Site {
if (headers.location) { if (headers.location) {
const _url = new URL(headers.location.slice(-1), url) const _url = new URL(headers.location.slice(-1), url)
const redirects = Object.keys(this.analyzedUrls).length - 1
if ( if (
_url.hostname.replace(/^www\./, '') === _url.hostname.replace(/^www\./, '') ===
this.originalUrl.hostname.replace(/^www\./, '') || this.originalUrl.hostname.replace(/^www\./, '') ||
(Object.keys(this.analyzedUrls).length === 1 && (redirects < 3 && !this.options.noRedirect)
!this.options.noRedirect)
) { ) {
url = _url url = _url