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

Status code: 403 #134

Closed
XM4ZE opened this issue Dec 10, 2024 · 13 comments
Closed

Status code: 403 #134

XM4ZE opened this issue Dec 10, 2024 · 13 comments
Labels
bug Something isn't working

Comments

@XM4ZE
Copy link

XM4ZE commented Dec 10, 2024

MinigetError: Status code: 403
    at ClientRequest.<anonymous> (/home/container/mywa/node_modules/miniget/src/index.ts:255:19)
    at Object.onceWrapper (node:events:628:26)
    at ClientRequest.emit (node:events:513:28)
    at HTTPParser.parserOnIncomingClient (node:_http_client:693:27)
    at HTTPParser.parserOnHeadersComplete (node:_http_common:119:17)
    at TLSSocket.socketOnData (node:_http_client:535:22)
    at TLSSocket.emit (node:events:513:28)
    at addChunk (node:internal/streams/readable:324:12)
    at readableAddChunk (node:internal/streams/readable:297:9)
    at TLSSocket.Readable.push (node:internal/streams/readable:234:10) {
  statusCode: 403
}

Example request

let ytdl = require('@distubejs/ytdl-core')
let fs = require("fs")

async function ytdlcore(url) {
	try {
		const agent = ytdl.createAgent(JSON.parse(fs.readFileSync("cookies.json")));
		const stream = ytdl(url, {
			filter: 'videoandaudio',
			agent
		});
		const chunks = [];
		stream.on("data", (chunk) => {
			chunks.push(chunk);
		});
		await new Promise((resolve, reject) => {
			stream.on("end", resolve);
			stream.on("error", reject);
		});
		const buffer = Buffer.concat(chunks);
		return {
			buffer: buffer,
			size: buffer.length
		};
	} catch (error) {
		throw error;
	}
}

return await ytdlcore('https://youtube.com/watch?v=0J2QdDbelmY')
  • @distube/ytdl-core version: 4.15.1
  • Node.js version: 20
  • Operating system: Ubuntu 22
@XM4ZE XM4ZE added the bug Something isn't working label Dec 10, 2024
@cchen028
Copy link

having the same issue, tried with new cookie but no luck

@XM4ZE
Copy link
Author

XM4ZE commented Dec 10, 2024

having the same issue, tried with new cookie but no luck

Same

@rafaelhovhannisyan24
Copy link

Same here

@rafaelhovhannisyan24
Copy link

rafaelhovhannisyan24 commented Dec 10, 2024

Has there been any progress on solving this issue? I tried to find a way, but didn’t succeed. It seems to be the same issue as before, related to regex.

@XM4ZE
Copy link
Author

XM4ZE commented Dec 10, 2024

Apakah ada kemajuan dalam menyelesaikan masalah ini? Saya mencoba mencari cara, tetapi tidak berhasil. Tampaknya masalahnya sama seperti sebelumnya, terkait dengan regex.

I think the problem is in miniget

@a26364177
Copy link

ref
LuanRT/YouTube.js#832

change sig/n regex

and replace n return undefined (LuanRT/YouTube.js#832 (comment))

@rafaelhovhannisyan24
Copy link

@a26364177 Which regex need to be fixed?

@luthfipun
Copy link

try this https://gist.github.com/luthfipun/3385a14816088d320ee00555667a1256

@rafaelhovhannisyan24
Copy link

Seems working for me. Thanks a lot.

@XM4ZE
Copy link
Author

XM4ZE commented Dec 11, 2024

ref LuanRT/YouTube.js#832

change sig/n regex

and replace n return undefined (LuanRT/YouTube.js#832 (comment))

Thank you. You saved my trouble 🙏🏻

@XM4ZE XM4ZE closed this as completed Dec 11, 2024
@XM4ZE
Copy link
Author

XM4ZE commented Dec 11, 2024

try this https://gist.github.com/luthfipun/3385a14816088d320ee00555667a1256

Thank you for giving an example 🙏🏻

@HugoLibanori
Copy link

200percentmicky added a commit to 200percentmicky/node-ytdl-core that referenced this issue Dec 11, 2024
giovanigenerali added a commit to giovanigenerali/ytdl-core that referenced this issue Dec 14, 2024
@flazouh
Copy link

flazouh commented Dec 18, 2024

It's not working for me... I've modified the sig.js and npx patch-package @distube/ytdl-core and got a 403

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

7 participants