Chocobozzz / PeerTube

ActivityPub-federated video streaming platform using P2P directly in your web browser
https://joinpeertube.org/
GNU Affero General Public License v3.0
13.09k stars 1.51k forks source link

Cant import Youtube Videos via URL - Cannot fetch Information from Import URL #6696

Closed tinfoil-hat-net closed 2 days ago

tinfoil-hat-net commented 2 weeks ago

Describe the current behavior

Hi, I can import videos via X/Twitter but not from youtube, I tried multible videos, that are public available and not age restriced, not unlisted, I get an error message "Cannot fetch Information from Import URL". Download a Video from Invidious is also not possible. My Peertube was manually set up some years ago on a LXC Container, this is the first time, I encountered problems with it. If you need Addidtional information, let me know

Steps to reproduce

Describe the expected behavior

Import Youtube Video from URL

Additional information

Chocobozzz commented 2 weeks ago

Hello,

Please paste your server logs

wearenh commented 4 days ago

Same problem here. yt-dlp has been seeing this issue due to changes on YouTube's side to aggressively block IP's after some amount of time. It's unclear if they ever remove the IP restriction.

Using the IP of remote runners could be a workaround, so that the PeerTube server's IP is not directly connecting to YouTube.

Logs:

error[11/10/2024, 11:32:52 AM] An error occurred while importing the video https://www.youtube.com/watch?v=AZXvhIpYwak.

{ "err": { "stack": "ExecaError: Command failed with exit code 1: /usr/bin/python3 /home/yunohost.app/peertube/storage/bin/yt-dlp --dump-json -f 'bestvideo[vcodec!=av01][vcodec!=vp9.2]+bestaudio/best[vcodec!=av01][vcodec!=vp9.2]/bestvideo[ext=mp4]+bestaudio[ext=m4a]/best' 'https://www.youtube.com/watch?v=AZXvhIpYwak'\n\nERROR: [youtube] AZXvhIpYwak: Sign in to confirm you’re not a bot. This helps protect our community. Learn more\n at getFinalError (file:///var/www/peertube/node_modules/execa/lib/return/final-error.js:6:9)\n at makeError (file:///var/www/peertube/node_modules/execa/lib/return/result.js:108:16)\n at getAsyncResult (file:///var/www/peertube/node_modules/execa/lib/methods/main-async.js:167:4)\n at handlePromise (file:///var/www/peertube/node_modules/execa/lib/methods/main-async.js:150:17)\n at async YoutubeDLCLI.run (file:///var/www/peertube/dist/core/helpers/youtube-dl/youtube-dl-cli.js:141:24)\n at async YoutubeDLCLI.getInfo (file:///var/www/peertube/dist/core/helpers/youtube-dl/youtube-dl-cli.js:89:22)\n at async YoutubeDLWrapper.getInfoForDownload (file:///var/www/peertube/dist/core/helpers/youtube-dl/youtube-dl-wrapper.js:23:22)\n at async buildYoutubeDLImport (file:///var/www/peertube/dist/core/lib/video-pre-import.js:104:25)\n at async handleYoutubeDlImport (file:///var/www/peertube/dist/core/controllers/api/videos/import.js:114:38)", "message": "Cannot fetch information from import for URL https://www.youtube.com/watch?v=AZXvhIpYwak", "code": 0, "cause": { "stack": "ExecaError: Command failed with exit code 1: /usr/bin/python3 /home/yunohost.app/peertube/storage/bin/yt-dlp --dump-json -f 'bestvideo[vcodec!=av01][vcodec!=vp9.2]+bestaudio/best[vcodec!=av01][vcodec!=vp9.2]/bestvideo[ext=mp4]+bestaudio[ext=m4a]/best' 'https://www.youtube.com/watch?v=AZXvhIpYwak'\n\nERROR: [youtube] AZXvhIpYwak: Sign in to confirm you’re not a bot. This helps protect our community. Learn more\n at getFinalError (file:///var/www/peertube/node_modules/execa/lib/return/final-error.js:6:9)\n at makeError (file:///var/www/peertube/node_modules/execa/lib/return/result.js:108:16)\n at getAsyncResult (file:///var/www/peertube/node_modules/execa/lib/methods/main-async.js:167:4)\n at handlePromise (file:///var/www/peertube/node_modules/execa/lib/methods/main-async.js:150:17)\n at async YoutubeDLCLI.run (file:///var/www/peertube/dist/core/helpers/youtube-dl/youtube-dl-cli.js:141:24)\n at async YoutubeDLCLI.getInfo (file:///var/www/peertube/dist/core/helpers/youtube-dl/youtube-dl-cli.js:89:22)\n at async YoutubeDLWrapper.getInfoForDownload (file:///var/www/peertube/dist/core/helpers/youtube-dl/youtube-dl-wrapper.js:23:22)\n at async buildYoutubeDLImport (file:///var/www/peertube/dist/core/lib/video-pre-import.js:104:25)\n at async handleYoutubeDlImport (file:///var/www/peertube/dist/core/controllers/api/videos/import.js:114:38)", "message": "Command failed with exit code 1: /usr/bin/python3 /home/yunohost.app/peertube/storage/bin/yt-dlp --dump-json -f 'bestvideo[vcodec!=av01][vcodec!=vp9.2]+bestaudio/best[vcodec!=av01][vcodec!=vp9.2]/bestvideo[ext=mp4]+bestaudio[ext=m4a]/best' 'https://www.youtube.com/watch?v=AZXvhIpYwak'\n\nERROR: [youtube] AZXvhIpYwak: Sign in to confirm you’re not a bot. This helps protect our community. Learn more", "shortMessage": "Command failed with exit code 1: /usr/bin/python3 /home/yunohost.app/peertube/storage/bin/yt-dlp --dump-json -f 'bestvideo[vcodec!=av01][vcodec!=vp9.2]+bestaudio/best[vcodec!=av01][vcodec!=vp9.2]/bestvideo[ext=mp4]+bestaudio[ext=m4a]/best' 'https://www.youtube.com/watch?v=AZXvhIpYwak'", "command": "/usr/bin/python3 /home/yunohost.app/peertube/storage/bin/yt-dlp --dump-json -f bestvideo[vcodec!=av01][vcodec!=vp9.2]+bestaudio/best[vcodec!=av01][vcodec!=vp9.2]/bestvideo[ext=mp4]+bestaudio[ext=m4a]/best https://www.youtube.com/watch?v=AZXvhIpYwak", "escapedCommand": "/usr/bin/python3 /home/yunohost.app/peertube/storage/bin/yt-dlp --dump-json -f 'bestvideo[vcodec!=av01][vcodec!=vp9.2]+bestaudio/best[vcodec!=av01][vcodec!=vp9.2]/bestvideo[ext=mp4]+bestaudio[ext=m4a]/best' 'https://www.youtube.com/watch?v=AZXvhIpYwak'", "cwd": "/var/www/peertube", "durationMs": 4034.717259, "failed": true, "timedOut": false, "isCanceled": false, "isGracefullyCanceled": false, "isTerminated": false, "isMaxBuffer": false, "isForcefullyTerminated": false, "exitCode": 1, "stdout": "", "stderr": "ERROR: [youtube] AZXvhIpYwak: Sign in to confirm you’re not a bot. This helps protect our community. Learn more", "stdio": [ null, "", "ERROR: [youtube] AZXvhIpYwak: Sign in to confirm you’re not a bot. This helps protect our community. Learn more" ], "ipcOutput": [], "pipedFrom": [] } } }

error[11/10/2024, 11:32:52 AM] Client log: Backend returned code 400, errorMessage is: Cannot fetch information from import for URL https://www.youtube.com/watch?v=AZXvhIpYwak

{ "tags": [ "client" ], "username": "root", "userAgent": "Mozilla/5.0 (X11; Linux x86_64; rv:131.0) Gecko/20100101 Firefox/131.0", "meta": "{\"url\":\"https://[SERVER URL]/api/v1/videos/imports/\"}", "url": "https://[SERVER URL]/videos/upload#import-url" }

error[11/10/2024, 11:32:52 AM] Client log: Error: Cannot fetch information from import for URL https://www.youtube.com/watch?v=AZXvhIpYwak

{ "tags": [ "client" ], "username": "root", "userAgent": "Mozilla/5.0 (X11; Linux x86_64; rv:131.0) Gecko/20100101 Firefox/131.0", "url": "https://[SERVER URL]/videos/upload#import-url" }

wearenh commented 4 days ago

Another possible solution would be to add a PO token field to the web configuration, and pass along in the command line.

https://github.com/yt-dlp/yt-dlp/wiki/Extractors#po-token-guide

Chocobozzz commented 2 days ago

Thanks for reporting this issue, but this is a duplicate of https://github.com/Chocobozzz/PeerTube/issues/6522