diff --git a/scripts/postinstall.js b/scripts/postinstall.js index 8f9693d..8bc89b2 100644 --- a/scripts/postinstall.js +++ b/scripts/postinstall.js @@ -4,14 +4,6 @@ const debug = require('debug-logfmt')('youtube-dl-exec:install') const { mkdir, chmod } = require('node:fs/promises') const { pipeline } = require('node:stream/promises') const { createWriteStream } = require('node:fs') -const { Readable } = require('node:stream') - -const httpGet = async url => - fetch(url, { - headers: { - 'user-agent': 'microlinkhq/youtube-dl-exec' - } - }) const { YOUTUBE_DL_PATH, @@ -26,15 +18,15 @@ const getLatest = async data => { const { browser_download_url: url } = assets.find( ({ name }) => name === YOUTUBE_DL_FILE ) - return httpGet(url) + return fetch(url) } const getBinary = async url => { - let response = await httpGet(url) + let response = await fetch(url) if (response.headers.get('content-type') !== 'application/octet-stream') { response = await getLatest(await response.json()) } - return Readable.fromWeb(response.body) + return response.body } const installBinary = async () => {