-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ee7ad01
commit 30b818e
Showing
21 changed files
with
1,140 additions
and
857 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,5 @@ tsup.config.ts | |
CHANGELOG.md | ||
Rotator.md | ||
docs | ||
examples/ | ||
examples/ | ||
.prettierignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
yarn/ | ||
docs/ | ||
.github/ | ||
dist/ | ||
bin/ |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,24 @@ | ||
const { Worker } = require("node:worker_threads") | ||
const { YoutubeiExtractor } = require("../../dist/index.js") // replace "../../dist/index.js" with "discord-player-youtubei" | ||
const { Worker } = require("node:worker_threads"); | ||
const { YoutubeiExtractor } = require("../../dist/index.js"); // replace "../../dist/index.js" with "discord-player-youtubei" | ||
|
||
const generateToken = () => new Promise((resolve, reject) => { | ||
const worker = new Worker(`${__dirname}/potoken.worker.js`) | ||
const generateToken = () => | ||
new Promise((resolve, reject) => { | ||
const worker = new Worker(`${__dirname}/potoken.worker.js`); | ||
|
||
worker.once("message", (v) => { | ||
resolve(v) | ||
}) | ||
resolve(v); | ||
}); | ||
|
||
worker.once("error", (v) => { | ||
reject(v) | ||
}) | ||
}); | ||
reject(v); | ||
}); | ||
}); | ||
|
||
// Register YoutubeiExtractor somewhere around here | ||
|
||
// Then, set the tokens to the youtubei extractor | ||
generateToken().then((tokens) => { | ||
const instance = YoutubeiExtractor.getInstance() | ||
const instance = YoutubeiExtractor.getInstance(); | ||
|
||
if(instance) instance.setTrustedTokens(tokens) | ||
}) | ||
if (instance) instance.setTrustedTokens(tokens); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
const { generateTrustedToken } = require("../../dist/index.js") | ||
const { parentPort } = require("node:worker_threads") | ||
const { generateTrustedToken } = require("../../dist/index.js"); | ||
const { parentPort } = require("node:worker_threads"); | ||
|
||
generateTrustedToken().then((v) => { | ||
parentPort.postMessage(v) | ||
}) | ||
parentPort.postMessage(v); | ||
}); |
Oops, something went wrong.