more pages
This commit is contained in:
parent
ada97a2286
commit
78b9b9ebc8
4 changed files with 75 additions and 5 deletions
|
@ -19,17 +19,17 @@ Your extractor should have 2 methods (required):
|
|||
// the duration in ms
|
||||
duration: 20000,
|
||||
// the thumbnail
|
||||
thumbnail: data.thumbnail,
|
||||
thumbnail: "some thumbnail link",
|
||||
// engine, can be Readable streams or link to raw stream that gets played
|
||||
engine: data.streamURL,
|
||||
engine: "someStreamLink",
|
||||
// number of views
|
||||
views: 0,
|
||||
// author of this stream
|
||||
author: data.artist.name,
|
||||
author: "Some Artist",
|
||||
// description
|
||||
description: "",
|
||||
// link of this stream
|
||||
url: data.url
|
||||
url: "Some Link"
|
||||
}
|
||||
```
|
||||
- `important: boolean`
|
||||
|
@ -40,5 +40,38 @@ Your extractor should have 2 methods (required):
|
|||
|
||||
This should be the version of your extractor. It is not really important and is set to `0.0.0` by default.
|
||||
|
||||
# Loading Extractors
|
||||
Discord Player Extractors can be loaded using `Player.use(ExtractorName, Extractor)` method.
|
||||
|
||||
## Register Extractor
|
||||
|
||||
```js
|
||||
const myExtractor = {
|
||||
version: "1.0.0",
|
||||
important: false,
|
||||
validate: (query) => true,
|
||||
getInfo: async (query) => {
|
||||
return {
|
||||
title: "Extracted by custom extractor",
|
||||
duration: 20000,
|
||||
thumbnail: "some thumbnail link",
|
||||
engine: "someStreamLink",
|
||||
views: 0,
|
||||
author: "Some Artist",
|
||||
description: "",
|
||||
url: "Some Link"
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
player.use("GiveItSomeName", myExtractor);
|
||||
```
|
||||
|
||||
## Remove Extractor
|
||||
|
||||
```js
|
||||
player.unuse("GiveItSomeName");
|
||||
```
|
||||
|
||||
# Examples
|
||||
### You can check out **[@discord-player/extractor](https://github.com/Snowflake107/discord-player-extractors)**
|
|
@ -6,3 +6,9 @@
|
|||
files:
|
||||
- name: Extractors API
|
||||
path: extractor.md
|
||||
- name: YouTube
|
||||
files:
|
||||
- name: Using Cookies
|
||||
path: cookies.md
|
||||
- name: Using Proxy
|
||||
path: proxy.md
|
15
docs/youtube/cookies.md
Normal file
15
docs/youtube/cookies.md
Normal file
|
@ -0,0 +1,15 @@
|
|||
# Using Cookies to avoid 429
|
||||
|
||||
```js
|
||||
const { Player } = require("discord-player");
|
||||
|
||||
const player = new Player(client, {
|
||||
ytdlDownloadOptions: {
|
||||
requestOptions: {
|
||||
headers: {
|
||||
cookie: "YOUR_YOUTUBE_COOKIE"
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
```
|
16
docs/youtube/proxy.md
Normal file
16
docs/youtube/proxy.md
Normal file
|
@ -0,0 +1,16 @@
|
|||
# Using Proxy to avoid 429
|
||||
|
||||
```js
|
||||
const { Player } = require("discord-player");
|
||||
const HttpsProxyAgent = require("https-proxy-agent");
|
||||
|
||||
// Remove "user:pass@" if you don't need to authenticate to your proxy.
|
||||
const proxy = "http://user:pass@111.111.111.111:8080";
|
||||
const agent = HttpsProxyAgent(proxy);
|
||||
|
||||
const player = new Player(client, {
|
||||
ytdlDownloadOptions: {
|
||||
requestOptions: { agent }
|
||||
}
|
||||
});
|
||||
```
|
Loading…
Reference in a new issue