microlinkhq / youtube-dl-exec Goto Github PK
View Code? Open in Web Editor NEWA simple Node.js wrapper for youtube-dl/yt-dlp.
License: MIT License
A simple Node.js wrapper for youtube-dl/yt-dlp.
License: MIT License
Can anyone tell me how to download the subtitles using this plugin? I'd like to download both the auto and human subtitles. Thanks in advance.
throws:
youtube-dl: error: no such option: --no-dump-json
I realize I can just leave it off and it works, but if someone programatically sets it to false, it shoudn't prepend --no-
After connecting the library to the JS project,
const youtubedl = require('youtube-dl-exec')
I get the following error in the browser console:
`Uncaught TypeError: Cannot read properties of undefined (reading 'signals')
at normalizeSignal (signals.js?93eb:30:1)
at Array.map (<anonymous>)
at getSignals (signals.js?93eb:10:1)
at getSignalsByName (main.js?0739:9:1)
at eval (main.js?0739:23:1)
at Object../node_modules/youtube-dl-exec/node_modules/human-signals/build/src/main.js (chunk-vendors.js:1210:1)
at __webpack_require__ (app.js:849:30)
at fn (app.js:151:20)
at eval (error.js?c63c:2:1)
at Object../node_modules/youtube-dl-exec/node_modules/execa/lib/error.js (chunk-vendors.js:1114:1)`
Library added to node_modules
Please, prompt in what there can be a reason. I can't find the answer on google
Hi,
It's seems that this package is not compatible with React-Native because it uses some module from NodeJS that are not implemented in React-Native, the modules involved are: assert, child_process, fs, os, path, stream and util. I tried to implement them first with
node-libs-react-native and then with rn-nodeify but I cannot make it works.
Do you have any Idea how I could use this package in a React-Native app ?
Thanks in advance.
in the src/index file has a method called isJSON
const isJSON = str => str.startsWith('{')
there is cause a problem when the param str is undefined
so, i modify it as below, it work
const isJSON = str => str ? str.startsWith('{') : false
Hello!
Using the package like so, I seem to get the variable undefined.
const youtubedl = require("youtube-dl-exec");
const stream = youtubedl(
data.queue[0].url,
{
o: '-',
q: '',
f: 'bestaudio[ext=webm+acodec=opus+asr=48000]/bestaudio',
r: '100K',
}, { stdio: ['ignore', 'pipe', 'ignore'] }
)
console.log(stream); // undefined
I've also tried to use the "raw" method, but that throws a "not a function".
const youtubedl = require("youtube-dl-exec").raw;
const stream = youtubedl(
data.queue[0].url,
{
o: '-',
q: '',
f: 'bestaudio[ext=webm+acodec=opus+asr=48000]/bestaudio',
r: '100K',
}, { stdio: ['ignore', 'pipe', 'ignore'] }
)
> "youtubedl" is not a function
My aim is to replace ytdl for my discord music bot with youtube-dl, using your wrapper.
Upon inspection, the package does indeed install a binary - im however very lost in why i cant use the package properly.
Edit: "youtube-dl-exec": "^2.0.9",
node-fetch is smaller, and we don't need these request libraries other than downloading youtube-dl
I'd love to have the option to return the downloaded file as a readable stream and pipe it to a write stream, similar to how it's done here. Is this difficult to implement? Thank you!
Hi there,
I actually fot this problem: Error: Couldn't find the python binary. Make sure it's installed and in your $PATH.
Here is the whole log:
npm ERR! path /home/container/node_modules/youtube-dl-exec npm ERR! command failed npm ERR! command sh -c npx bin-version-check-cli python ">=2" npm ERR! Error: Couldn't find the python binary. Make sure it's installed and in your $PATH. npm ERR! at binaryVersion (file:///home/container/.npm/_npx/7b761a280cf4a94b/node_modules/bin-version/index.js:44:22) npm ERR! at processTicksAndRejections (node:internal/process/task_queues:96:5) npm ERR! at async binaryVersionCheck (file:///home/container/.npm/_npx/7b761a280cf4a94b/node_modules/bin-version-check/index.js:14:18)
npm ERR! A complete log of this run can be found in: npm ERR! /home/container/.npm/_logs/2022-02-17T23_06_47_501Z-debug-0.log
I'm actually inside a container, using Docker. My home path is /home/container
Eviroment:
Anyone who can help me?
Hi, thank for job.
After has install Python 3.10
and youtube-dl-exec, i've attempt run minimal snippet code of Usage documentation.
But i've error at output as:
Error: Command failed with exit code 3221225781: <PATH>\node_modules\youtube-dl-exec\bin\youtube-dl.exe https://www.youtube.com/watch?v=6xKWiCMKKJg --dump-single-json --no-warnings --no-call-home --no-check-certificate --prefer-free-formats --youtube-skip-dash-manifest --referer https://www.youtube.com/watch?v=6xKWiCMKKJg
at makeError (<PATH>\node_modules\execa\lib\error.js:60:11)
at handlePromise (<PATH>\node_modules\execa\index.js:118:26)
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
shortMessage: 'Command failed with exit code 3221225781: <PATH>\\node_modules\\youtube-dl-exec\\bin\\youtube-dl.exe https://www.youtube.com/watch?v=6xKWiCMKKJg --dump-single-json --no-warnings --no-call-home --no-check-certificate --prefer-free-formats --youtube-skip-dash-manifest --referer https://www.youtube.com/watch?v=6xKWiCMKKJg',
command: '<PATH>\\node_modules\\youtube-dl-exec\\bin\\youtube-dl.exe https://www.youtube.com/watch?v=6xKWiCMKKJg --dump-single-json --no-warnings --no-call-home --no-check-certificate --prefer-free-formats --youtube-skip-dash-manifest --referer https://www.youtube.com/watch?v=6xKWiCMKKJg',
escapedCommand: '"<PATH>\\node_modules\\youtube-dl-exec\\bin\\youtube-dl.exe" "https://www.youtube.com/watch?v=6xKWiCMKKJg" --dump-single-json --no-warnings --no-call-home --no-check-certificate --prefer-free-formats --youtube-skip-dash-manifest --referer "https://www.youtube.com/watch?v=6xKWiCMKKJg"',
exitCode: 3221225781,
signal: undefined,
signalDescription: undefined,
stdout: '',
stderr: '',
failed: true,
timedOut: false,
isCanceled: false,
killed: false
}
Output error is not very dev friendly give only a not documented error code 3221225781
and call stack.
I've see at other issue same problem has been opened #30 but never response has been provide.
I porpose documented for error code provide at output.
sorry I know I'm not supposed to ask here but please help me with this
I need a way to read the current binary path.
The only way I could find to do this was using require('youtube-dl-exec/src/constants')
which works for now but doesn't seem ideal.
It may be useful to export the constants from the module itself. I have created a pull request containing this change.
Pull Request here: #70
https://docs.npmjs.com/cli/v7/configuring-npm/package-json#config
I think using npm_package_config
is better over npm_config
. why? npm_config
env variables will always be lowercase when accessed from process.env
, while npm_package_config
does not.
It is also easier to read JSON files on runtime than .npmrc
files (this could be used for #43)
Let me know if you agree or have other opinions about this
Hi!
Thanks for writing this - the new wrapper is far easier to use!
I seem to be hitting issues when dealing with playlists, not sure if it's down to my implementation in the code or an error with your library, hopefully you can help!
Here's a simple test function I wrote:
const youtubedl = require("youtube-dl-exec")
async function Test(VideoURL){
let result = await youtubedl(VideoURL,{
dumpJson: true,
noCallHome: true,
})
console.log(result)
}
Test("https://www.youtube.com/playlist?list=PLvgS71fU12MawZ_u2HverscJHqsB84M3z")
When I run this I get the following error:
node utils/temp.js
(node:352052) UnhandledPromiseRejectionWarning: SyntaxError: Unexpected token { in JSON at position 37553
at JSON.parse (<anonymous>)
at parse (/home/robert/Documents/Personal-Code/ssvd-metafetcher/node_modules/youtube-dl-exec/src/index.js:13:54)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async Test (/home/robert/Documents/Personal-Code/ssvd-metafetcher/utils/temp.js:4:18)
if I run the youtube-dl command by hand, it does return valid JSON:
node_modules/youtube-dl-exec/bin/youtube-dl --no-call-home --dump-json https://www.youtube.com/playlist?list=PLVJa0bdiLG6H9zOYoNEt_J-PtQFrp22wx | jq
(the output was huge, so I'll spare pasting it here, but jq parsed the output without any problems)
It works perfectly with a single video, so only seems to affect playlists, I've tried a few different playlist URL's and it seems an issue on all of them,
I've also tried with the noWarnings param and that made no difference.
youtube-dl binary version is: 2021.04.17
(though tried it with latest and made no difference)
youtube-dl-exec version is: 1.2.1
node version is: v14.16.0
OS is: Ubuntu 20.04
Hopefully it's something simple!
Hello. I noticed that some videos I try to download are flagged requiring an age limit, so I'm getting a 410 error. I tried adding cookies to my request like the following:
ytdl( this.url, { o: '-', q: '', f: 'bestaudio[ext=webm+acodec=opus+asr=48000]/bestaudio', r: '100K', cookies: 'C:\\Users\\USER\\cookies.txt' }, { stdio: ['ignore', 'pipe', 'ignore'] }, );
However I am still getting the same 410 error. When I run youtube-dl manually e.g.
youtube-dl --cookies=C:\\Users\\USER\\cookies.txt https://www.youtube.com/watch?v=j0lN0w5HVT8&t=1s
it successfully downloads the video.
When using the -f (format) option, youtube-dl-exec's converter puts a =
between -f and the value, instead of a space.
For example: youtubedl(link, { g: true, f: format })
youtube-dl [link] -g -f=[format]
youtube-dl [link] -g -f [format]
to work.Other options may also suffer from this problem, but I don't really have time to experiment right now (sorry).
Error: Command failed with exit code 1: /root/yt2s.hub/node_modules/youtube-dl-exec/bin/youtube-dl https://youtube.com/watch?v=dQw4w9WgXcQ-g -f=140 ERROR: requested format not available at makeError (/root/yt2s.hub/node_modules/execa/lib/error.js:59:11) at handlePromise (/root/yt2s.hub/node_modules/execa/index.js:114:26) at processTicksAndRejections (node:internal/process/task_queues:94:5)
I want to use yt-dlp with youtube-dl-exec. While using https://github.com/microlinkhq/youtube-dl-exec#environment-variables can download the correct binary, but on runtime, we need to set YOUTUBE_DL_FILENAME
manually in process.env
It should implement or document how to handle different binary filenames at runtime.
Either document how to do it with process.env
or create something to handle these different binary filenames, either way, I'm fine
2021-10-24T09:15:09.936Z 85f334fc-5831-45bb-b3fb-652f79ba3857 INFO Error: Command failed with exit code 127: /opt/nodejs/node_modules/youtube-dl-exec/bin/youtube-dl https://www.youtube.com/watch?v=P_MfXIRQIwc --dump-single-json --no-warnings --no-call-home --no-check-certificate --prefer-free-formats --youtube-skip-dash-manifest --referer https://www.youtube.com/watch?v=P_MfXIRQIwc
/usr/bin/env: python: No such file or directory
at makeError (/opt/nodejs/node_modules/execa/lib/error.js:60:11)
at handlePromise (/opt/nodejs/node_modules/execa/index.js:118:26)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async getYoutubeVideCloseCpationV2 (/var/task/handlers/webscraper/v1/index.js:253:22)
at async Runtime.module.exports.handler (/var/task/handlers/webscraper/v1/index.js:65:27) {
shortMessage: 'Command failed with exit code 127: /opt/nodejs/node_modules/youtube-dl-exec/bin/youtube-dl https://www.youtube.com/watch?v=P_MfXIRQIwc --dump-single-json --no-warnings --no-call-home --no-check-certificate --prefer-free-formats --youtube-skip-dash-manifest --referer https://www.youtube.com/watch?v=P_MfXIRQIwc',
command: '/opt/nodejs/node_modules/youtube-dl-exec/bin/youtube-dl https://www.youtube.com/watch?v=P_MfXIRQIwc --dump-single-json --no-warnings --no-call-home --no-check-certificate --prefer-free-formats --youtube-skip-dash-manifest --referer https://www.youtube.com/watch?v=P_MfXIRQIwc',
escapedCommand: '"/opt/nodejs/node_modules/youtube-dl-exec/bin/youtube-dl" "https://www.youtube.com/watch?v=P_MfXIRQIwc" --dump-single-json --no-warnings --no-call-home --no-check-certificate --prefer-free-formats --youtube-skip-dash-manifest --referer "https://www.youtube.com/watch?v=P_MfXIRQIwc"',
exitCode: 127,
signal: undefined,
signalDescription: undefined,
stdout: '',
stderr: '/usr/bin/env: python: No such file or directory',
failed: true,
timedOut: false,
isCanceled: false,
killed: false
}
Look like youtube object doesn't have the pipe function?
I'm trying to use Lambda + this library to stream youtube videos to S3 Without any download to /tmp
const stream = require('stream');
const youtubedl = require('youtube-dl-exec')
const AWS = require('aws-sdk');
const BUCKET_NAME = "storage-bucket"
youtubedl.raw('https://www.youtube.com/watch?v=4cquiuAQBco', {
dumpSingleJson: true,
noWarnings: true,
noCallHome: true,
noCheckCertificate: true,
preferFreeFormats: true,
youtubeSkipDashManifest: true,
referer: 'https://facebook.com',
})
.then(
output => {
console.log(output)
const passtrough = new stream.PassThrough();
console.log(output.id)
const key = output.id+`.mp4`;
const upload = new AWS.S3.ManagedUpload({
accessKeyId: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
secretAccessKey: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
params: {
Bucket: BUCKET_NAME,
Key: key,
Body: passtrough
},
partSize: 1024 * 1024 * 64 // in bytes
});
upload.on('httpUploadProgress', (progress) => {
console.log(`[`+output.id+`] copying video ...`, progress);
});
upload.send((err) => {
if (err) {
cb(err);
} else {
cb(null, {
bucketName: BUCKET_NAME,
key,
url: `s3://`+BUCKET_NAME+`/`+key
});
}
});
output.pipe(passtrough);
})
I ran the example code from the github snippet. It was working 3 days ago: it saved the video to the directory and logged the output in console, but now it no longer works? There's no video output for some reason
const youtubedl = require('youtube-dl-exec')
youtubedl('https://www.youtube.com/watch?v=6xKWiCMKKJg', {
dumpSingleJson: true,
noWarnings: true,
noCallHome: true,
noCheckCertificate: true,
preferFreeFormats: true,
youtubeSkipDashManifest: true,
referer: 'https://www.youtube.com/watch?v=6xKWiCMKKJg'
}).then(output => console.log(output))
The issue is similar to the one that this pull request in node-ytdl-core is fixing. Can someone do the same in youtube-dl-exec, please?
Currently, it seems like the binary can only be downloaded from S3. I created przemyslawpluta/node-youtube-dl#351 on node-youtube-dl
Since this package supersedes node-youtube-dl
I think there should be an option for a custom mirror.
A possible implementation could use the YOUTUBE_DL_DIRECT_BINARY_DOWNLOAD_URL
environment variable:
YOUTUBE_DL_DIRECT_BINARY_DOWNLOAD_URL - download the youtube-dl binary from the given download url, completely ignoring the ** YOUTUBE_DL_HOST**
option, while performing no lookup for retrieving the latest version of the binary. This is useful if you are hosting the youtube-dl binary on your own S3 bucket. The platform-specific extension will be appended.
E.g. the value https://xxxxx.s3.xxxxxx.amazonaws.com/2020.11.12-youtube-dl
will result in downloading https://xxxxx.s3.xxxxxx.amazonaws.com/2020.11.12-youtube-dl.exe
on windows.
I have this snippet of code here
const youtubedl = require('youtube-dl-exec')
const fs = require('fs');
async function downloadVid(urlString) {
const resp = await youtubedl('https://www.youtube.com/watch?v=dQw4w9WgXcQ', {dumpJson: true})
console.log(await resp)
fs.writeFile('helloworld.txt', (await resp).toString(), function (err) {
if (err) return console.log(err);
console.log('Hello World > helloworld.txt');
});
}
downloadVid()
My goal is to:
The code here only outputs the JSON dump to the console but does not save it. In fact, it just saves "[Object object]" to the file. It also does not download the the video. I have to remove the parameters to make it do that.
Is this a bug or a misunderstanding on my end
I am trying to use "youtube-dl-exec" in electron, it works fine in a development environment, but when I package the application "youtube-dl-exec" it doesn't work.
Error: Command failed with ENOENT: C:\Users\vital\AppData\Local\Programs\vitalplayer\resources\app.asar\node_modules\youtube-dl-exec\bin\youtube-dl.exe https://example.com/artejones --dump-single-json --no-warnings --no-call-home --no-check-certificate --prefer-free-formats --youtube-skip-dash-manifest --referer https://example.com/artejones spawn C:\Users\vital\AppData\Local\Programs\vitalplayer\resources\app.asar\node_modules\youtube-dl-exec\bin\youtube-dl.exe ENOENT at Process.ChildProcess._handle.onexit (internal/child_process.js:264) at onErrorNT (internal/child_process.js:456) at processTicksAndRejections (internal/process/task_queues.js:80)
package.json
"dependencies": { "source-map-support": "^0.5.16", "electron-updater": "^4.0.6", "youtube-dl-exec": "^2.0.7" },
I am unable to find any way to gracefully stop the download. Even if I use the raw ChildProcess and kill it, the youtube-dl process is killed but it leaves the ffmpeg process hanging, locking the resulting file. And manually killing the ffmpeg process leaves the file corrupted.
[PLAY] โ Obtive erros no comando /play โ Command failed with exit code 3221225781: C:\Users\Meu\kaotic\node_modules\youtube-dl-exec\bin\youtube-dl.exe https://youtu.be/EiQmbrvvDaY --no-warnings --no-call-home --no-check-certificate --prefer-free-formats --youtube-skip-dash-manifest --referer https://youtu.be/EiQmbrvvDaY -x --audio-format mp3 -o ./lib/media/audio/55759803244997.mp3 -
Error: Cannot find module 'fs/promises'
Require stack:
-<folder>/node_modules/youtube-dl-exec/scripts/postinstall.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)
at Function.Module._load (internal/modules/cjs/loader.js:667:27)
at Module.require (internal/modules/cjs/loader.js:887:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (<folder>/node_modules/youtube-dl-exec/scripts/postinstall.js:4:12)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'<folder>/node_modules/youtube-dl-exec/scripts/postinstall.js'
]
}
This is probably fixed with changing
const fs = require("fs/promises");
to
const fs = require("fs").promises;
I reverted back to version 1.0.0 for now.
Love the package ๐
After using the --dump-json
flag I get a json file in which the formats contain a vbr field but that field is not declared in the YtFormat
type and thus not accessible in the wrapper.
I'm working on a whatsapp bot using whatsapp-web.js which is about to download videos from social media. It requires me to send the media either using base64 string or a link.
Is there a way to do this without downloading the video on my desktop ?
I could do it with node-ytdl-core but it only allows youtube videos
Hello there, people of Microlink :)
I come from a land afar to help you with package quality.
Here's my plan:
is-unix
youtube-dl
from path before attempting to install itIf you sign off on each of these changes, I'll open PRs for them.
W20211109-17:05:13.651(5)? (STDERR) (node:19624) UnhandledPromiseRejectionWarning: TypeError [ERR_INVALID_ARG_TYPE]: The "original" argument must be of type function
W20211109-17:05:13.697(5)? (STDERR) at promisify (internal/util.js:209:11)
W20211109-17:05:13.697(5)? (STDERR) at Object. (D:\irisvision\iv-web-management-platform\node_modules\youtube-dl-exec\node_modules\get-stream\index.js:7:35)
W20211109-17:05:13.697(5)? (STDERR) at Module._compile (module.js:652:30)
W20211109-17:05:13.697(5)? (STDERR) at Object.Module._extensions..js (module.js:663:10)
W20211109-17:05:13.698(5)? (STDERR) at Module.load (module.js:565:32)
W20211109-17:05:13.698(5)? (STDERR) at tryModuleLoad (module.js:505:12)
W20211109-17:05:13.698(5)? (STDERR) at Function.Module._load (module.js:497:3)
W20211109-17:05:13.698(5)? (STDERR) at Module.require (module.js:596:17)
W20211109-17:05:13.698(5)? (STDERR) at require (internal/module.js:11:18)
W20211109-17:05:13.698(5)? (STDERR) at Object. (D:\irisvision\iv-web-management-platform\node_modules\youtube-dl-exec\node_modules\execa\lib\stream.js:3:19)
W20211109-17:05:13.698(5)? (STDERR) at Module._compile (module.js:652:30)
W20211109-17:05:13.699(5)? (STDERR) at Object.Module._extensions..js (module.js:663:10)
W20211109-17:05:13.700(5)? (STDERR) at Module.load (module.js:565:32)
W20211109-17:05:13.700(5)? (STDERR) at tryModuleLoad (module.js:505:12)
W20211109-17:05:13.700(5)? (STDERR) at Function.Module._load (module.js:497:3)
W20211109-17:05:13.700(5)? (STDERR) at Module.require (module.js:596:17)
W20211109-17:05:13.700(5)? (STDERR) (node:19624) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
W20211109-17:05:13.700(5)? (STDERR) (node:19624) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Similar to the older "youtube-dl" i need some types to use it.
I've encountered two errors around bin-version-check-cli
:
When running npm i youtube-dl-exec
, I was met with the following error (on both Windows and Linux, though this example is from my windows machine):
T:\all 3\code\search-and-download>npm i youtube-dl-exec
npm ERR! code 1
npm ERR! path T:\all 3\code\search-and-download\node_modules\youtube-dl-exec
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c npx bin-version-check-cli python ">=2"
npm ERR! 'bin-version-check' is not recognized as an internal or external command,
npm ERR! operable program or batch file.
I was able to solve this by manually running npm i -g bin-version-check-cli
, but this could be listed as a dependency for youtube-dl-exec
, which I think would solve this issue. (Though, I could be wrong)
Even after installing bin-version-check-cli
, trying to run npm i youtube-dl-exec
yields the following (again, on both OS's):
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c npx bin-version-check-cli python ">=2"
npm ERR! Error: Couldn't find the `python` binary. Make sure it's installed and in your $PATH.
However, I do have python
installed, on both machines. The issue here arises because on both windows and linux, python
wasn't a valid command. The valid command was py
on windows and python3
on linux. I was able to fix this on windows by installing python from the app store, which added the python
command to the terminal. This seems fixable by looking for not just python
but py
and python3
.
How to get all videos with audio? That means I want to merge them together.
Getting this error!!!
Error: Command failed with exit code 1: /var/www/vhosts/xyz.com/httpdocs/node_modules/youtube-dl-exec/bin/youtube-dl https://www.youtube.com/watch?v=LPM1sY0ipNM --dump-single-json --no-warnings --format 140 --audio-format mp3 --no-check-certificate --prefer-free-formats --extract-audio --youtube-skip-dash-manifest --referer https://www.youtube.com/watch?v=LPM1sY0ipNM
ERROR: No video formats found; 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 makeError (/var/www/vhosts/xyz.com/httpdocs/node_modules/execa/lib/error.js:60:11)
at handlePromise (/var/www/vhosts/xyz.com/httpdocs/node_modules/execa/index.js:118:26)
at runMicrotasks ()
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Object.apiResolver (/var/www/vhosts/xyz.com/httpdocs/node_modules/next/dist/server/api-utils.js:101:9)
at async NextNodeServer.runApi (/var/www/vhosts/xyz.com/httpdocs/node_modules/next/dist/server/next-server.js:319:9)
at async Object.fn (/var/www/vhosts/xyz.com/httpdocs/node_modules/next/dist/server/base-server.js:486:37)
at async Router.execute (/var/www/vhosts/xyz.com/httpdocs/node_modules/next/dist/server/router.js:228:32)
at async NextNodeServer.run (/var/www/vhosts/xyz.com/httpdocs/node_modules/next/dist/server/base-server.js:598:29)
at async NextNodeServer.handleRequest (/var/www/vhosts/xyz.com/httpdocs/node_modules/next/dist/server/base-server.js:305:20)
When I installed this package for the first time to use it's video download capabilities, it said I would need a python binary and need to add it to my path. The thing is, will users of my app need to do the same thing for them to use the app(download Python and add it to their path)?
Hello,
I'd like to know how to get it's download progress. The output doesn't seems to be working.
const youtubedl = require('youtube-dl-exec');
youtubedl('https://d2zihajmogu5jn.cloudfront.net/bipbop-advanced/bipbop_16x9_variant.m3u8', {
noWarnings: true,
noCheckCertificate: true,
}).then((output) => console.log(output));
I have this error when install with npm im already have python installed python3
npm ERR! code 1
npm ERR! path /home/carlos/Documentos/Development/Projects/NextCloud projects/Node js Bot Nextcloud/node_modules/youtube-dl-exec
npm ERR! command failed
npm ERR! command sh -c npm run check && node scripts/postinstall.js
npm ERR! > [email protected] check
npm ERR! > bin-version-check python ">=2"
npm ERR! Error: Couldn't find the python
binary. Make sure it's installed and in your $PATH.
Instead of provided comonjs require i would like to use
import * as youtubedlexec from 'youtube-dl-exec'
const { create: createYoutubeDl } = youtubedlexec
const ytdlpath='path_to_my_ytdl'
const youtubedl = createYoutubeDl(ytdlpath)
then i use example code from readme
youtubedl('https://url-of-mine', {
dumpSingleJson: true,
noWarnings: true,
noCallHome: true,
noCheckCertificate: true,
preferFreeFormats: true,
youtubeSkipDashManifest: true,
referer: 'https://example.com'
})
.then(output => console.log(output))
and i got
in output this
{
id: '40011486',
ext: 'mp3',
url: 'http://s17sas.storage.yandex.net/get-mp3/...
skiped }
do i need to fetch url by my self, or youtube-dl-exec can do it? there is no problem but info question
how to do this?
Just installed the dependency on a new project and realize that it did not work.
Upon inspection inside of .\node_modules\youtube-dl-exec\bin
is empty.
EDIT: I have installed this with no antivirus or malware software running, and it still did not install
The current workaround is just copying youtube-dl
from another location to the bin
folder.
Install details:
hello,
since the official youtube-dl release does not seems to be up to date I'm trying out the yt-dlp fork and so far it seems to work fine (and faster)
if someone is interested in testing those are the necessary ENVs:
YOUTUBE_DL_HOST=https://api.github.com/repos/yt-dlp/yt-dlp/releases?per_page=1
YOUTUBE_DL_FILENAME=yt-dlp
beside some different output
behavior it works, so my suggestion is to consider an official switch -- if not feel free to close, thanks for the lib!
Does this support https://github.com/yt-dlp/yt-dlp?
i want to stream youtube from a specific time
so i add youtube url ?t=30 (likes 'https://www.youtube.com/watch?v=sqgxcCjD04s&t=149s')
but this plays the song from the beginning
const stream = ytdlexec(startUrl, { o: '-', q: '', f: 'bestaudio[ext=webm+acodec=opus+asr=48000]/bestaudio', r: '100K', }, { stdio: ['ignore', 'pipe', 'ignore'] })
this is my code
Hi, i want to download the link directly to the client
In ytdl-core
I have code:
app.get('/test', (req, res) => {
var url = "https://www.youtube.com/watch?v=[id]";
res.header("Content-Disposition", 'attachment; filename="Video.mp4');
ytdl(url,{ format: 'mp4' }).pipe(res);
})
How can i do the same in youtube-dl-exec ? thanks for help
Did anyone got this package working in Electron using Webpack 5?
From what I know the thing which makes this complicated is that webpack 5 does not provide auto-polyfill anymore. Even after trying to add everything necessary Iยดm just running from one issue to another.
If someone has an idea which steps are needed to make this work, it would be great if you could share this :)
Thanks
Hello,
I am using the library inside an express.js application.
My dependencies are mainly:
"dependencies": { "express": "^4.17.1", "youtube-dl-exec": "^1.2.0" }, "devDependencies": { "jest": "^26.6.3", "nodemon": "^2.0.7", "prettier": "2.2.1" }
Works well with local testing but when deploying to Heroku I am getting the following error:
ERROR: Unable to download webpage: HTTP Error 429: - (caused by <HTTPError 429: '-'>);
Is this a common issue? Do we get 429 because of Instagram blocking the request?
Attched is my full heroku log:
Error: Command failed with exit code 1: /app/node_modules/youtube-dl-exec/bin/youtube-dl https://www.instagram.com/p/CCRq_InFZ44 --dump-json --no-warnings --no-call-home --no-check-certificate --prefer-free-formats --youtube-skip-dash-manifest 2021-04-06T23:52:47.208255+00:00 app[web.1]: ERROR: Unable to download webpage: HTTP Error 429: - (caused by <HTTPError 429: '-'>); 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. 2021-04-06T23:52:47.208256+00:00 app[web.1]: at makeError (/app/node_modules/youtube-dl-exec/node_modules/execa/lib/error.js:59:11) 2021-04-06T23:52:47.208256+00:00 app[web.1]: at handlePromise (/app/node_modules/youtube-dl-exec/node_modules/execa/index.js:114:26) 2021-04-06T23:52:47.208257+00:00 app[web.1]: at processTicksAndRejections (node:internal/process/task_queues:94:5) { 2021-04-06T23:52:47.208257+00:00 app[web.1]: shortMessage: 'Command failed with exit code 1: /app/node_modules/youtube-dl-exec/bin/youtube-dl https://www.instagram.com/p/CCRq_InFZ44 --dump-json --no-warnings --no-call-home --no-check-certificate --prefer-free-formats --youtube-skip-dash-manifest', 2021-04-06T23:52:47.208260+00:00 app[web.1]: command: '/app/node_modules/youtube-dl-exec/bin/youtube-dl https://www.instagram.com/p/CCRq_InFZ44 --dump-json --no-warnings --no-call-home --no-check-certificate --prefer-free-formats --youtube-skip-dash-manifest', 2021-04-06T23:52:47.208260+00:00 app[web.1]: exitCode: 1, 2021-04-06T23:52:47.208260+00:00 app[web.1]: signal: undefined, 2021-04-06T23:52:47.208261+00:00 app[web.1]: signalDescription: undefined, 2021-04-06T23:52:47.208261+00:00 app[web.1]: stdout: '', 2021-04-06T23:52:47.208262+00:00 app[web.1]: stderr: "ERROR: Unable to download webpage: HTTP Error 429: - (caused by <HTTPError 429: '-'>); 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.", 2021-04-06T23:52:47.208262+00:00 app[web.1]: failed: true, 2021-04-06T23:52:47.208262+00:00 app[web.1]: timedOut: false, 2021-04-06T23:52:47.208262+00:00 app[web.1]: isCanceled: false, 2021-04-06T23:52:47.208263+00:00 app[web.1]: killed: false 2021-04-06T23:52:47.208263+00:00 app[web.1]: }
This npm package currently (as of v1.2.2) has some security issues within its dependencies, which originate from the bin-version-check-cli
package. The last time this package has been updated was two years ago, which is why it uses outdated dependencies. I was trying to resolve the issue, but then I realized this package seems like an unused dependency within your project. Can you please confirm this assumption and if so remove the dependency or otherwise tell me how this package is used within your project?
PS: below is the output of npm audit
=== npm audit security report ===
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Manual Review โ
โ Some vulnerabilities require your attention to resolve โ
โ โ
โ Visit https://go.npm.me/audit-guide for additional guidance โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Low โ Prototype Pollution โ
โโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Package โ yargs-parser โ
โโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Patched in โ >=13.1.2 <14.0.0 || >=15.0.1 <16.0.0 || >=18.1.2 โ
โโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Dependency of โ youtube-dl-exec โ
โโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Path โ youtube-dl-exec > bin-version-check-cli > meow > โ
โ โ yargs-parser โ
โโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ More info โ https://npmjs.com/advisories/1500 โ
โโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
found 1 low severity vulnerability in 381 scanned packages
1 vulnerability requires manual review. See the full report for details.
I tried using your code from "Usage" and got : Uncaught ReferenceError: require is not defined.
After that i tried a lot of fixes and changed const youtubedl = require('youtube-dl-exec')
to import * as youtubedl from 'youtube-dl-exec';
and got another error : Module parse failed: 'import' and 'export' may appear only with 'sourceType: module' (1:0)
module.exports = {
entry: './src/js/2.js',
optimization: {
minimize: false
},
devtool: 'inline-source-map',
resolve: {
extensions: ['.tsx', '.ts', '.js'],
},
module: {
rules: [
{
"test": /\.js$/,
"exclude": /node_modules/,
"use": {
"loader": "babel-loader",
"options": {
"presets": [
"@babel/preset-env",
]
}
}
},
]
},
"mode": "none",
}
Package.json
{
"scripts": {
"start": "webpack --mode development --watch"
},
"dependencies": {
"babel-loader": "^8.2.3",
"path-browserify": "^1.0.1",
"webpack": "^5.69.1",
"webpack-cli": "^4.9.2",
"youtube-dl-exec": "^2.0.5"
},
"type": "commonjs",
"babel": {
"presets": [
"@babel/env"
]
}
}
i keep getting this error every time i try to install, and yes i do have python.
npm ERR! code 1
npm ERR! path C:\Users\prote\OneDrive\Documents\GitHub\xxxx\node_modules\youtube-dl-exec
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c npx bin-version-check-cli python ">=2"
npm ERR! Error: Couldn't find version of python
npm ERR! at binaryVersion (file:///C:/Users/prote/AppData/Local/npm-cache/_npx/7b761a280cf4a94b/node_modules/bin-version/index.js:55:8)
npm ERR! at processTicksAndRejections (node:internal/process/task_queues:96:5)
npm ERR! at async binaryVersionCheck (file:///C:/Users/prote/AppData/Local/npm-cache/_npx/7b761a280cf4a94b/node_modules/bin-version-check/index.js:14:18)
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\prote\AppData\Local\npm-cache_logs\2022-03-21T04_05_37_646Z-debug-0.log
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.