diff options
author | Chocobozzz <me@florianbigard.com> | 2020-11-18 14:11:15 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2020-11-18 14:11:15 +0100 |
commit | e0409585a744ab7b41869bc08bfb2b33febe3bba (patch) | |
tree | f43718d68fa7adaad65c846af1fc9b280829b7a1 | |
parent | 677012b4ee53e5099e8c90445616644e1a6af9ef (diff) | |
download | PeerTube-e0409585a744ab7b41869bc08bfb2b33febe3bba.tar.gz PeerTube-e0409585a744ab7b41869bc08bfb2b33febe3bba.tar.zst PeerTube-e0409585a744ab7b41869bc08bfb2b33febe3bba.zip |
Fix youtube-dl ipv4 PR
-rw-r--r-- | config/default.yaml | 5 | ||||
-rw-r--r-- | config/production.yaml.example | 5 | ||||
-rw-r--r-- | server/helpers/youtube-dl.ts | 6 | ||||
-rw-r--r-- | server/initializers/config.ts | 4 |
4 files changed, 12 insertions, 8 deletions
diff --git a/config/default.yaml b/config/default.yaml index c315878b2..da04c0e95 100644 --- a/config/default.yaml +++ b/config/default.yaml | |||
@@ -285,9 +285,10 @@ import: | |||
285 | videos: | 285 | videos: |
286 | http: # Classic HTTP or all sites supported by youtube-dl https://rg3.github.io/youtube-dl/supportedsites.html | 286 | http: # Classic HTTP or all sites supported by youtube-dl https://rg3.github.io/youtube-dl/supportedsites.html |
287 | enabled: false | 287 | enabled: false |
288 | |||
288 | # IPv6 is very strongly rate-limited on most sites supported by youtube-dl | 289 | # IPv6 is very strongly rate-limited on most sites supported by youtube-dl |
289 | forceipv4: | 290 | force_ipv4: false |
290 | enabled: true | 291 | |
291 | # You can use an HTTP/HTTPS/SOCKS proxy with youtube-dl | 292 | # You can use an HTTP/HTTPS/SOCKS proxy with youtube-dl |
292 | proxy: | 293 | proxy: |
293 | enabled: false | 294 | enabled: false |
diff --git a/config/production.yaml.example b/config/production.yaml.example index bbaafd9b4..ec38f4cf7 100644 --- a/config/production.yaml.example +++ b/config/production.yaml.example | |||
@@ -299,9 +299,10 @@ import: | |||
299 | videos: | 299 | videos: |
300 | http: # Classic HTTP or all sites supported by youtube-dl https://rg3.github.io/youtube-dl/supportedsites.html | 300 | http: # Classic HTTP or all sites supported by youtube-dl https://rg3.github.io/youtube-dl/supportedsites.html |
301 | enabled: false | 301 | enabled: false |
302 | |||
302 | # IPv6 is very strongly rate-limited on most sites supported by youtube-dl | 303 | # IPv6 is very strongly rate-limited on most sites supported by youtube-dl |
303 | forceipv4: | 304 | force_ipv4: false |
304 | enabled: true | 305 | |
305 | # You can use an HTTP/HTTPS/SOCKS proxy with youtube-dl | 306 | # You can use an HTTP/HTTPS/SOCKS proxy with youtube-dl |
306 | proxy: | 307 | proxy: |
307 | enabled: false | 308 | enabled: false |
diff --git a/server/helpers/youtube-dl.ts b/server/helpers/youtube-dl.ts index 8733fe6cf..302b2e206 100644 --- a/server/helpers/youtube-dl.ts +++ b/server/helpers/youtube-dl.ts | |||
@@ -34,7 +34,11 @@ const processOptions = { | |||
34 | function getYoutubeDLInfo (url: string, opts?: string[]): Promise<YoutubeDLInfo> { | 34 | function getYoutubeDLInfo (url: string, opts?: string[]): Promise<YoutubeDLInfo> { |
35 | return new Promise<YoutubeDLInfo>((res, rej) => { | 35 | return new Promise<YoutubeDLInfo>((res, rej) => { |
36 | let args = opts || [ '-j', '--flat-playlist' ] | 36 | let args = opts || [ '-j', '--flat-playlist' ] |
37 | if (CONFIG.IMPORT.VIDEOS.HTTP.FORCEIPV4) args.push('--force-ipv4') | 37 | |
38 | if (CONFIG.IMPORT.VIDEOS.HTTP.FORCE_IPV4) { | ||
39 | args.push('--force-ipv4') | ||
40 | } | ||
41 | |||
38 | args = wrapWithProxyOptions(args) | 42 | args = wrapWithProxyOptions(args) |
39 | 43 | ||
40 | safeGetYoutubeDL() | 44 | safeGetYoutubeDL() |
diff --git a/server/initializers/config.ts b/server/initializers/config.ts index d1bbbc9a7..705223b0a 100644 --- a/server/initializers/config.ts +++ b/server/initializers/config.ts | |||
@@ -229,9 +229,7 @@ const CONFIG = { | |||
229 | VIDEOS: { | 229 | VIDEOS: { |
230 | HTTP: { | 230 | HTTP: { |
231 | get ENABLED () { return config.get<boolean>('import.videos.http.enabled') }, | 231 | get ENABLED () { return config.get<boolean>('import.videos.http.enabled') }, |
232 | FORCEIPV4: { | 232 | get FORCE_IPV4 () { return config.get<boolean>('import.videos.http.force_ipv4') }, |
233 | get ENABLED () { return config.get<boolean>('import.videos.http.forceipv4.enabled') } | ||
234 | }, | ||
235 | PROXY: { | 233 | PROXY: { |
236 | get ENABLED () { return config.get<boolean>('import.videos.http.proxy.enabled') }, | 234 | get ENABLED () { return config.get<boolean>('import.videos.http.proxy.enabled') }, |
237 | get URL () { return config.get<string>('import.videos.http.proxy.url') } | 235 | get URL () { return config.get<string>('import.videos.http.proxy.url') } |