Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Twitch] Getting 404 for a twitch clip #30945

Closed
dirkf opened this issue May 13, 2022 · 5 comments
Closed

[Twitch] Getting 404 for a twitch clip #30945

dirkf opened this issue May 13, 2022 · 5 comments

Comments

@dirkf
Copy link
Contributor

dirkf commented May 13, 2022

Originally posted by @dement6d in #30942 (comment)


Getting a similar issue for a twitch clip

I'm using the latest bin release of youtube-dl for linux

I'm trying to download a twitch clip using youtube-dl through a node.js app

console.log("Executing: " + `./youtube-dl ${clipLink} -o ${clipsFolder}/${clipTitle}.mp4`)
execSync(`./youtube-dl ${clipLink} -o ${clipsFolder}/clip${index}.mp4`);

the command im executing there works through the terminal but when done through the node app i get this error:

Executing: ./youtube-dl https://production.assets.clips.twitchcdn.net/AT-cm%7CKvyqkeREW5ETF3Sf_KheYA.mp4?sig=4d112865666fab9ee3b556eac64783920f5372b6&token=%7B%22authorization%22%3A%7B%22forbidden%22%3Afalse%2C%22reason%22%3A%22%22%7D%2C%22clip_uri%22%3A%22https%3A%2F%2Fproduction.assets.clips.twitchcdn.net%2FAT-cm%257CKvyqkeREW5ETF3Sf_KheYA.mp4%22%2C%22device_id%22%3Anull%2C%22expires%22%3A1652539411%2C%22user_id%22%3A%22%22%2C%22version%22%3A2%7D -o clips/Dono wants xQc to gamble his $105 donation.mp4
/bin/sh: line 1: -o: command not found
WARNING: Could not send HEAD request to https://production.assets.clips.twitchcdn.net/AT-cm%7CKvyqkeREW5ETF3Sf_KheYA.mp4?sig=4d112865666fab9ee3b556eac64783920f5372b6: HTTP Error 404: 
ERROR: Unable to download webpage: HTTP Error 404:  (caused by <HTTPError 404: ''>); please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; type  youtube-dl -U  to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.
node:internal/errors:841
  const err = new Error(message);
              ^

Error: Command failed: ./youtube-dl https://production.assets.clips.twitchcdn.net/AT-cm%7CKvyqkeREW5ETF3Sf_KheYA.mp4?sig=4d112865666fab9ee3b556eac64783920f5372b6&token=%7B%22authorization%22%3A%7B%22forbidden%22%3Afalse%2C%22reason%22%3A%22%22%7D%2C%22clip_uri%22%3A%22https%3A%2F%2Fproduction.assets.clips.twitchcdn.net%2FAT-cm%257CKvyqkeREW5ETF3Sf_KheYA.mp4%22%2C%22device_id%22%3Anull%2C%22expires%22%3A1652539411%2C%22user_id%22%3A%22%22%2C%22version%22%3A2%7D -o clips/clip0.mp4
/bin/sh: line 1: -o: command not found
WARNING: Could not send HEAD request to https://production.assets.clips.twitchcdn.net/AT-cm%7CKvyqkeREW5ETF3Sf_KheYA.mp4?sig=4d112865666fab9ee3b556eac64783920f5372b6: HTTP Error 404: 
ERROR: Unable to download webpage: HTTP Error 404:  (caused by <HTTPError 404: ''>); please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; type  youtube-dl -U  to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.

    at checkExecSyncError (node:child_process:828:11)
    at execSync (node:child_process:899:15)
    at /home/demented/repos/twitch-clips-bot/dl-clip.js:34:9
    at Array.forEach (<anonymous>)
    at /home/demented/repos/twitch-clips-bot/dl-clip.js:27:11 {
  status: 127,
  signal: null,
  output: [
    null,
    Buffer(118) [Uint8Array] [
       91, 103, 101, 110, 101, 114, 105,  99,  93,  32,  65,  84,
       45,  99, 109, 124,  75, 118, 121, 113, 107, 101,  82,  69,
       87,  53,  69,  84,  70,  51,  83, 102,  95,  75, 104, 101,
       89,  65,  58,  32,  82, 101, 113, 117, 101, 115, 116, 105,
      110, 103,  32, 104, 101,  97, 100, 101, 114,  10,  91, 103,
      101, 110, 101, 114, 105,  99,  93,  32,  65,  84,  45,  99,
      109, 124,  75, 118, 121, 113, 107, 101,  82,  69,  87,  53,
       69,  84,  70,  51,  83, 102,  95,  75, 104, 101,  89,  65,
       58,  32,  68, 111,
      ... 18 more items
    ],
    Buffer(520) [Uint8Array] [
       47,  98, 105, 110,  47, 115, 104,  58,  32, 108, 105, 110,
      101,  32,  49,  58,  32,  45, 111,  58,  32,  99, 111, 109,
      109,  97, 110, 100,  32, 110, 111, 116,  32, 102, 111, 117,
      110, 100,  10,  87,  65,  82,  78,  73,  78,  71,  58,  32,
       67, 111, 117, 108, 100,  32, 110, 111, 116,  32, 115, 101,
      110, 100,  32,  72,  69,  65,  68,  32, 114, 101, 113, 117,
      101, 115, 116,  32, 116, 111,  32, 104, 116, 116, 112, 115,
       58,  47,  47, 112, 114, 111, 100, 117,  99, 116, 105, 111,
      110,  46,  97, 115,
      ... 420 more items
    ]
  ],
  pid: 34528,
  stdout: Buffer(118) [Uint8Array] [
     91, 103, 101, 110, 101, 114, 105,  99,  93,  32,  65,  84,
     45,  99, 109, 124,  75, 118, 121, 113, 107, 101,  82,  69,
     87,  53,  69,  84,  70,  51,  83, 102,  95,  75, 104, 101,
     89,  65,  58,  32,  82, 101, 113, 117, 101, 115, 116, 105,
    110, 103,  32, 104, 101,  97, 100, 101, 114,  10,  91, 103,
    101, 110, 101, 114, 105,  99,  93,  32,  65,  84,  45,  99,
    109, 124,  75, 118, 121, 113, 107, 101,  82,  69,  87,  53,
     69,  84,  70,  51,  83, 102,  95,  75, 104, 101,  89,  65,
     58,  32,  68, 111,
    ... 18 more items
  ],
  stderr: Buffer(520) [Uint8Array] [
     47,  98, 105, 110,  47, 115, 104,  58,  32, 108, 105, 110,
    101,  32,  49,  58,  32,  45, 111,  58,  32,  99, 111, 109,
    109,  97, 110, 100,  32, 110, 111, 116,  32, 102, 111, 117,
    110, 100,  10,  87,  65,  82,  78,  73,  78,  71,  58,  32,
     67, 111, 117, 108, 100,  32, 110, 111, 116,  32, 115, 101,
    110, 100,  32,  72,  69,  65,  68,  32, 114, 101, 113, 117,
    101, 115, 116,  32, 116, 111,  32, 104, 116, 116, 112, 115,
     58,  47,  47, 112, 114, 111, 100, 117,  99, 116, 105, 111,
    110,  46,  97, 115,
    ... 420 more items
  ]
}
@dirkf
Copy link
Contributor Author

dirkf commented May 13, 2022

  1. Quote, or otherwise distinguish, the URL and the argument of the -o option. The documentation of the child_process.execSync() method is silent about how the command is parsed but says it is "generally identical to child_process.exec()" and that method separates command arguments at spaces. You probably want child_process.spawnSync().

  2. yt-dl's Twitch extractor only knows about certain pages in the twitch.tv domain. A URL like https://production.assets.clips.twitchcdn.net/... might possibly be handled by yt-dl's generic extractor, but all indications are that you're doing whatever you want to do wrong.

@dirkf
Copy link
Contributor Author

dirkf commented Jun 1, 2022

@dement6d ?

@dirkf dirkf closed this as not planned Won't fix, can't repro, duplicate, stale Jun 6, 2022
@mk-pmb
Copy link
Contributor

mk-pmb commented Jan 12, 2024

In case anyone might be wondering, line 2 of the pasted log file, the /bin/sh: line 1: -o: command not found means that the shell command was split at the first &, which commands sh to

  1. start a background task with the command ./youtube-dl https://production.assets.clips.twitchcdn.net/AT-[…]0f5372b6
  2. start an interactive task with the command token=[…]%7D -o clips/Dono wants xQc to gamble his $105 donation.mp4 which means to run the -o program with an environment variable token set to some value.
  3. Since there was no program named -o installed, sh complained and the interactive task finished (failed) almost immediately.
  4. Meanwhile in the background yt-dl tried to download the truncated URL but failed because there was no token in that URL.

@dirkf
Copy link
Contributor Author

dirkf commented Jan 12, 2024

Just so, except it's sh, not bash; hence point 1 above.

@mk-pmb
Copy link
Contributor

mk-pmb commented Jan 12, 2024

Oh right, of course. I edited my post to fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants