-
-
Notifications
You must be signed in to change notification settings - Fork 94
YouTube Cookies
Skick edited this page Apr 19, 2024
·
9 revisions
- Prevent YouTube rate limiting (429 Error)
- Capable of playing videos accessible through your account, including age-restricted, exclusive member, premium, private, and more.
- Install EditThisCookie extension for your browser.
- Go to YouTube.
- Log in to your account. (You should use a new account for this purpose)
- Click on the extension icon and click "Export".
- Copy the content of the exported file and paste it into your code.
const { DisTube } = require("distube");
const distube = new DisTube({
"...",
youtubeCookie: [
{
domain: ".youtube.com",
expirationDate: 1234567890,
hostOnly: false,
httpOnly: true,
name: "LOGIN_INFO",
path: "/",
sameSite: "no_restriction",
secure: true,
session: false,
value: "---xxx---",
},
{
domain: ".youtube.com",
...
}
],
});
- Or you can paste it into a file and use
fs.readFileSync
to read it.
const { DisTube } = require("distube");
const fs = require("fs");
const distube = new DisTube({
"...",
youtubeCookie: JSON.parse(fs.readFileSync("cookies.json")),
});