From 677012b4ee53e5099e8c90445616644e1a6af9ef Mon Sep 17 00:00:00 2001 From: Mark Van den Borre Date: Wed, 18 Nov 2020 14:06:20 +0100 Subject: [PATCH] default youtube-dl to use ipv4 (#3311) Co-authored-by: Rigel Kent --- config/default.yaml | 3 +++ config/production.yaml.example | 3 +++ server/helpers/youtube-dl.ts | 1 + server/initializers/config.ts | 3 +++ 4 files changed, 10 insertions(+) diff --git a/config/default.yaml b/config/default.yaml index b16fafa40..c315878b2 100644 --- a/config/default.yaml +++ b/config/default.yaml @@ -285,6 +285,9 @@ import: videos: http: # Classic HTTP or all sites supported by youtube-dl https://rg3.github.io/youtube-dl/supportedsites.html enabled: false + # IPv6 is very strongly rate-limited on most sites supported by youtube-dl + forceipv4: + enabled: true # You can use an HTTP/HTTPS/SOCKS proxy with youtube-dl proxy: enabled: false diff --git a/config/production.yaml.example b/config/production.yaml.example index 6c331b8b3..bbaafd9b4 100644 --- a/config/production.yaml.example +++ b/config/production.yaml.example @@ -299,6 +299,9 @@ import: videos: http: # Classic HTTP or all sites supported by youtube-dl https://rg3.github.io/youtube-dl/supportedsites.html enabled: false + # IPv6 is very strongly rate-limited on most sites supported by youtube-dl + forceipv4: + enabled: true # You can use an HTTP/HTTPS/SOCKS proxy with youtube-dl proxy: enabled: false diff --git a/server/helpers/youtube-dl.ts b/server/helpers/youtube-dl.ts index c2aa8870a..8733fe6cf 100644 --- a/server/helpers/youtube-dl.ts +++ b/server/helpers/youtube-dl.ts @@ -34,6 +34,7 @@ const processOptions = { function getYoutubeDLInfo (url: string, opts?: string[]): Promise { return new Promise((res, rej) => { let args = opts || [ '-j', '--flat-playlist' ] + if (CONFIG.IMPORT.VIDEOS.HTTP.FORCEIPV4) args.push('--force-ipv4') args = wrapWithProxyOptions(args) safeGetYoutubeDL() diff --git a/server/initializers/config.ts b/server/initializers/config.ts index b70361aa9..d1bbbc9a7 100644 --- a/server/initializers/config.ts +++ b/server/initializers/config.ts @@ -229,6 +229,9 @@ const CONFIG = { VIDEOS: { HTTP: { get ENABLED () { return config.get('import.videos.http.enabled') }, + FORCEIPV4: { + get ENABLED () { return config.get('import.videos.http.forceipv4.enabled') } + }, PROXY: { get ENABLED () { return config.get('import.videos.http.proxy.enabled') }, get URL () { return config.get('import.videos.http.proxy.url') }