ybd-project / ytdl-core

Fast and secure YouTube downloader for JavaScript and TypeScript
MIT License
28 stars 5 forks source link

Undici throw ETIMEDOUT, ENETUNREACH #26

Closed nikitafloy closed 1 week ago

nikitafloy commented 2 months ago

Describe the bug

When I try to download the file, I get the following errors: ETIMEDOUT, ENETUNREACH.

The error occurs when the undici package tries to get the index.m3u8 file from manifest.googlevideo.com.

Error Details (Log)

AggregateError
    at internalConnectMultiple (node:net:1117:18)
    at internalConnectMultiple (node:net:1185:5)
    at Timeout.internalConnectMultipleTimeout (node:net:1711:5)
    at listOnTimeout (node:internal/timers:575:11)
    at processTimers (node:internal/timers:514:7) {
  code: 'ETIMEDOUT',
  [errors]: [
    Error: connect ETIMEDOUT 142.250.186.110:443
        at createConnectionError (node:net:1647:14)
        at Timeout.internalConnectMultipleTimeout (node:net:1706:38)
        at listOnTimeout (node:internal/timers:575:11)
        at processTimers (node:internal/timers:514:7) {
      errno: -110,
      code: 'ETIMEDOUT',
      syscall: 'connect',
      address: '142.250.186.110',
      port: 443
    },
    Error: connect ENETUNREACH 2a00:1450:4001:829::200e:443 - Local (:::0)
        at internalConnectMultiple (node:net:1181:16)
        at Timeout.internalConnectMultipleTimeout (node:net:1711:5)
        at listOnTimeout (node:internal/timers:575:11)
        at processTimers (node:internal/timers:514:7) {
      errno: -101,
      code: 'ENETUNREACH',
      syscall: 'connect',
      address: '2a00:1450:4001:829::200e',
      port: 443
    }
  ]
}

How to solve locally:

Add to the DNS configuration in /etc/resolv.conf: 1.1.1.1 and 8.8.8.8.

In result you got:

nameserver 1.1.1.1
nameserver 8.8.8.8
nameserver 127.0.0.53

Environment

nikitafloy commented 2 months ago

Maybe it can be solved through undici, my knowledge is not enough for that.

ybd-project commented 2 months ago

Thank you for the report. We will investigate this issue. Maybe it is a problem with your network environment. Please keep this in mind.