Repository: yt-dlp
Issue: [generic] Redirect loop
Labels: bug

### DO NOT REMOVE OR SKIP THE ISSUE TEMPLATE

- [X] I understand that I will be **blocked** if I remove or skip any mandatory\* field

### Checklist

- [X] I'm reporting a bug unrelated to a specific site
- [X] I've verified that I'm running yt-dlp version **2022.08.19** ([update instructions](https://github.com/yt-dlp/yt-dlp#update)) or later (specify commit)
- [X] I've checked that all provided URLs are playable in a browser with the same IP and same login details
- [X] I've checked that all URLs and arguments with special characters are [properly quoted or escaped](https://github.com/ytdl-org/youtube-dl#video-url-contains-an-ampersand-and-im-getting-some-strange-output-1-2839-or-v-is-not-recognized-as-an-internal-or-external-command)
- [X] I've searched the [bugtracker](https://github.com/yt-dlp/yt-dlp/issues?q=) for similar issues **including closed ones**. DO NOT post duplicates
- [X] I've read the [guidelines for opening an issue](https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#opening-an-issue)

### Provide a description that is worded well enough to be understood

yt-dlp logs ERROR: maximum recursion depth while using the generic extractor for this url redirecting to a login, https://humsci.stanford.edu/covid-19.

(And when yt-dlp is embedded in an application, processing url https://humsci.stanford.edu/covid-19 appears to be causing a crash, logging `Fatal Python error: Cannot recover from stack overflow`.)

### Provide verbose output that clearly demonstrates the problem

- [X] Run **your** yt-dlp command with **-vU** flag added (`yt-dlp -vU <your command line>`)
- [X] Copy the WHOLE output (starting with `[debug] Command-line config`) and insert it below

### Complete Verbose Output

```shell
[debug] Command-line config: ['-vU', 'https://humsci.stanford.edu/covid-19']
[debug] Encodings: locale UTF-8, fs utf-8, pref UTF-8, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version 2022.08.19 [48c88e0] (pip)
[debug] Python 3.8.10 (CPython 64bit) - Linux-5.4.0-42-generic-x86_64-with-glibc2.29 (glibc 2.31)
[debug] Checking exe version: ffmpeg -bsfs
[debug] Checking exe version: ffprobe -bsfs
[debug] exe versions: ffmpeg 4.2.7, ffprobe 4.2.7
[debug] Optional libraries: Cryptodome-3.14.1, brotli-1.0.9, certifi-2022.06.15, mutagen-1.45.1, sqlite3-2.6.0, websockets-10.3
[debug] Proxy map: {}
[debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp/releases/latest
Latest version: 2022.08.19, Current version: 2022.08.19
yt-dlp is up to date (2022.08.19)
[debug] [generic] Extracting URL: https://humsci.stanford.edu/covid-19
[generic] covid-19: Downloading webpage
[redirect] Following redirect to https://humsci.stanford.edu/user/login?destination=covid-19
[debug] [generic] Extracting URL: https://humsci.stanford.edu/user/login?destination=covid-19
[generic] login?destination=covid-19: Downloading webpage
WARNING: [generic] Falling back on generic information extractor
[generic] login?destination=covid-19: Extracting information
[debug] Looking for Brightcove embeds
[debug] Looking for embeds
[redirect] Following redirect to https://humsci.stanford.edu/big_pipe/no-js?destination=covid-19
[debug] [generic] Extracting URL: https://humsci.stanford.edu/big_pipe/no-js?destination=covid-19
[generic] no-js?destination=covid-19: Downloading webpage
[redirect] Following redirect to https://humsci.stanford.edu/user/login?destination=covid-19
[debug] [generic] Extracting URL: https://humsci.stanford.edu/user/login?destination=covid-19
[generic] login?destination=covid-19: Downloading webpage
WARNING: [generic] Falling back on generic information extractor
[generic] login?destination=covid-19: Extracting information
[[ many repeats, leading to error: "There was an error creating your issue: body is too long (maximum is 65536 characters)." ]]
[debug] Looking for Brightcove embeds
[debug] Looking for embeds
[redirect] Following redirect to https://humsci.stanford.edu/big_pipe/no-js?destination=covid-19
[debug] [generic] Extracting URL: https://humsci.stanford.edu/big_pipe/no-js?destination=covid-19
[generic] no-js?destination=covid-19: Downloading webpage
ERROR: maximum recursion depth exceeded while calling a Python object
Traceback (most recent call last):
  File "/opt/brozzler-ve3/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 1442, in wrapper
    return func(self, *args, **kwargs)
  File "/opt/brozzler-ve3/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 1518, in __extract_info
    ie_result = ie.extract(url)
  File "/opt/brozzler-ve3/lib/python3.8/site-packages/yt_dlp/extractor/common.py", line 666, in extract
    ie_result = self._real_extract(url)
  File "/opt/brozzler-ve3/lib/python3.8/site-packages/yt_dlp/extractor/generic.py", line 2641, in _real_extract
    full_response = self._request_webpage(url, video_id, headers={'Accept-Encoding': '*'})
  File "/opt/brozzler-ve3/lib/python3.8/site-packages/yt_dlp/extractor/common.py", line 799, in _request_webpage
    return self._downloader.urlopen(self._create_request(url_or_request, data, headers, query))
  File "/opt/brozzler-ve3/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 3648, in urlopen
    return self._opener.open(req, timeout=self._socket_timeout)
  File "/usr/lib/python3.8/urllib/request.py", line 531, in open
    response = meth(req, response)
  File "/usr/lib/python3.8/urllib/request.py", line 640, in http_response
    response = self.parent.error(
  File "/usr/lib/python3.8/urllib/request.py", line 563, in error
    result = self._call_chain(*args)
  File "/usr/lib/python3.8/urllib/request.py", line 502, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.8/urllib/request.py", line 755, in http_error_302
    return self.parent.open(new, timeout=req.timeout)
  File "/usr/lib/python3.8/urllib/request.py", line 531, in open
    response = meth(req, response)
  File "/usr/lib/python3.8/urllib/request.py", line 640, in http_response
    response = self.parent.error(
  File "/usr/lib/python3.8/urllib/request.py", line 563, in error
    result = self._call_chain(*args)
  File "/usr/lib/python3.8/urllib/request.py", line 502, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.8/urllib/request.py", line 755, in http_error_302
    return self.parent.open(new, timeout=req.timeout)
  File "/usr/lib/python3.8/urllib/request.py", line 525, in open
    response = self._open(req, data)
  File "/usr/lib/python3.8/urllib/request.py", line 542, in _open
    result = self._call_chain(self.handle_open, protocol, protocol +
  File "/usr/lib/python3.8/urllib/request.py", line 502, in _call_chain
    result = func(*args)
  File "/opt/brozzler-ve3/lib/python3.8/site-packages/yt_dlp/utils.py", line 1468, in https_open
    return self.do_open(
  File "/usr/lib/python3.8/urllib/request.py", line 1354, in do_open
    h.request(req.get_method(), req.selector, req.data, headers,
  File "/usr/lib/python3.8/http/client.py", line 1256, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib/python3.8/http/client.py", line 1302, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.8/http/client.py", line 1251, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.8/http/client.py", line 1011, in _send_output
    self.send(msg)
  File "/usr/lib/python3.8/http/client.py", line 951, in send
    self.connect()
  File "/usr/lib/python3.8/http/client.py", line 1418, in connect
    super().connect()
  File "/usr/lib/python3.8/http/client.py", line 922, in connect
    self.sock = self._create_connection(
  File "/usr/lib/python3.8/socket.py", line 787, in create_connection
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
  File "/usr/lib/python3.8/socket.py", line 920, in getaddrinfo
    addrlist.append((_intenum_converter(af, AddressFamily),
  File "/usr/lib/python3.8/socket.py", line 103, in _intenum_converter
    return enum_klass(value)
  File "/opt/brozzler-ve3/lib/python3.8/enum.py", line 339, in __call__
    return cls.__new__(cls, value)
  File "/opt/brozzler-ve3/lib/python3.8/enum.py", line 635, in __new__
    if type(value) is cls:
RecursionError: maximum recursion depth exceeded while calling a Python object
```