more pages

This commit is contained in:
Snowflake107 2021-04-21 14:15:40 +05:45
parent ada97a2286
commit 78b9b9ebc8
4 changed files with 75 additions and 5 deletions

View file

@ -19,17 +19,17 @@ Your extractor should have 2 methods (required):
// the duration in ms // the duration in ms
duration: 20000, duration: 20000,
// the thumbnail // the thumbnail
thumbnail: data.thumbnail, thumbnail: "some thumbnail link",
// engine, can be Readable streams or link to raw stream that gets played // engine, can be Readable streams or link to raw stream that gets played
engine: data.streamURL, engine: "someStreamLink",
// number of views // number of views
views: 0, views: 0,
// author of this stream // author of this stream
author: data.artist.name, author: "Some Artist",
// description // description
description: "", description: "",
// link of this stream // link of this stream
url: data.url url: "Some Link"
} }
``` ```
- `important: boolean` - `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. 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 # Examples
### You can check out **[@discord-player/extractor](https://github.com/Snowflake107/discord-player-extractors)** ### You can check out **[@discord-player/extractor](https://github.com/Snowflake107/discord-player-extractors)**

View file

@ -6,3 +6,9 @@
files: files:
- name: Extractors API - name: Extractors API
path: extractor.md 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
View 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
View 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 }
}
});
```