⚡ properly remove xvdl (#286)
This commit is contained in:
parent
36fa63f0fd
commit
e603461e73
5 changed files with 38 additions and 83 deletions
7
index.js
7
index.js
|
@ -2,6 +2,9 @@ process.env.YTDL_NO_UPDATE = true
|
|||
|
||||
module.exports = {
|
||||
Extractors: require('./src/Extractors/Extractor'),
|
||||
version: require('./package.json').version,
|
||||
Player: require('./src/Player')
|
||||
Player: require('./src/Player'),
|
||||
Queue: require('./src/Queue'),
|
||||
Track: require('./src/Track'),
|
||||
Util: require('./src/Util'),
|
||||
version: require('./package.json').version
|
||||
}
|
||||
|
|
|
@ -40,8 +40,8 @@
|
|||
"reverbnation-scraper": "^2.0.0",
|
||||
"soundcloud-scraper": "^4.0.3",
|
||||
"spotify-url-info": "^2.2.0",
|
||||
"youtube-sr": "^3.0.0",
|
||||
"ytdl-core": "^4.4.3"
|
||||
"youtube-sr": "^4.0.0",
|
||||
"ytdl-core": "^4.5.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@discordjs/opus": "^0.4.0",
|
||||
|
|
|
@ -9,7 +9,7 @@ const Track = require('./Track')
|
|||
const Util = require('./Util')
|
||||
const { EventEmitter } = require('events')
|
||||
const Client = new soundcloud.Client()
|
||||
const { VimeoExtractor, DiscordExtractor, FacebookExtractor, ReverbnationExtractor, XVideosExtractor } = require('./Extractors/Extractor')
|
||||
const { VimeoExtractor, DiscordExtractor, FacebookExtractor, ReverbnationExtractor } = require('./Extractors/Extractor')
|
||||
|
||||
/**
|
||||
* @typedef Filters
|
||||
|
@ -194,8 +194,6 @@ class Player extends EventEmitter {
|
|||
return 'reverbnation'
|
||||
} else if (this.util.isDiscordAttachment(query)) {
|
||||
return 'attachment'
|
||||
} else if (this.util.isXVLink(query)) {
|
||||
return 'xvlink'
|
||||
} else {
|
||||
return 'youtube-video-keywords'
|
||||
}
|
||||
|
@ -342,32 +340,6 @@ class Player extends EventEmitter {
|
|||
}
|
||||
})
|
||||
|
||||
tracks.push(track)
|
||||
} else if (queryType === 'xvlink') {
|
||||
const data = await XVideosExtractor.getInfo(query).catch(() => {})
|
||||
if (!data || !(data.streams.lq || data.streams.hq)) return this.emit('noResults', message, query)
|
||||
|
||||
const track = new Track({
|
||||
title: data.title,
|
||||
url: data.url,
|
||||
thumbnail: data.thumbnail,
|
||||
lengthSeconds: data.length,
|
||||
description: '',
|
||||
views: data.views,
|
||||
author: {
|
||||
name: data.channel.name
|
||||
}
|
||||
}, message.author, this)
|
||||
|
||||
Object.defineProperties(track, {
|
||||
arbitrary: {
|
||||
get: () => true
|
||||
},
|
||||
stream: {
|
||||
get: () => data.streams.lq || data.streams.hq
|
||||
}
|
||||
})
|
||||
|
||||
tracks.push(track)
|
||||
}
|
||||
|
||||
|
@ -697,7 +669,7 @@ class Player extends EventEmitter {
|
|||
/**
|
||||
* Custom search function
|
||||
* @param {string} query Search query
|
||||
* @param {("youtube"|"soundcloud"|"xvideos")} type Search type
|
||||
* @param {("youtube"|"soundcloud")} type Search type
|
||||
* @returns {Promise<any[]>}
|
||||
*/
|
||||
async search (query, type = 'youtube') {
|
||||
|
@ -706,11 +678,6 @@ class Player extends EventEmitter {
|
|||
switch (type.toLowerCase()) {
|
||||
case 'soundcloud':
|
||||
return await Client.search(query, 'track').catch(() => {}) || []
|
||||
case 'xvideos':
|
||||
// eslint-disable-next-line
|
||||
let videos = await XVideosExtractor.search(query).catch(() => {})
|
||||
if (!videos) return []
|
||||
return videos.videos
|
||||
default:
|
||||
return ytsr.search(query, { type: 'video' }).catch(() => {}) || []
|
||||
}
|
||||
|
|
|
@ -7,7 +7,6 @@ const spotifyPlaylistRegex = (/https?:\/\/(?:embed\.|open\.)(?:spotify\.com\/)(?
|
|||
const spotifyAlbumRegex = (/https?:\/\/(?:embed\.|open\.)(?:spotify\.com\/)(?:album\/|\?uri=spotify:album:)((\w|-){22})/)
|
||||
const vimeoRegex = (/(http|https)?:\/\/(www\.|player\.)?vimeo\.com\/(?:channels\/(?:\w+\/)?|groups\/([^/]*)\/videos\/|video\/|)(\d+)(?:|\/\?)/)
|
||||
const facebookRegex = (/(https?:\/\/)(www\.|m\.)?(facebook|fb).com\/.*\/videos\/.*/)
|
||||
const xvRegex = (/(http|https):\/\/(.+)?xvideos.com\/(.+)\/(.+)/)
|
||||
|
||||
module.exports = class Util {
|
||||
constructor () {
|
||||
|
@ -20,7 +19,7 @@ module.exports = class Util {
|
|||
prism.FFmpeg.getInfo()
|
||||
return true
|
||||
} catch {
|
||||
this.alertFFMPEG()
|
||||
Util.alertFFMPEG()
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
@ -81,10 +80,6 @@ module.exports = class Util {
|
|||
return /https:\/\/cdn.discordapp.com\/attachments\/(\d{17,19})\/(\d{17,19})\/(.+)/.test(query)
|
||||
}
|
||||
|
||||
static isXVLink (query) {
|
||||
return xvRegex.test(query)
|
||||
}
|
||||
|
||||
static buildTimecode (data) {
|
||||
const items = Object.keys(data)
|
||||
const required = ['days', 'hours', 'minutes', 'seconds']
|
||||
|
|
66
typings/index.d.ts
vendored
66
typings/index.d.ts
vendored
|
@ -44,7 +44,7 @@ declare module 'discord-player' {
|
|||
public setRepeatMode(message: Message, enabled: boolean): boolean;
|
||||
public setLoopMode(message: Message, enabled: boolean): boolean
|
||||
public shuffle(message: Message): Queue;
|
||||
public remove(message: Message, trackOrPosition: Track|number): Track;
|
||||
public remove(message: Message, trackOrPosition: Track | number): Track;
|
||||
public createProgressBar(message: Message, progressBarOptions: ProgressBarOptions): string;
|
||||
|
||||
public on<K extends keyof PlayerEvents>(event: K, listener: (...args: PlayerEvents[K]) => void): this;
|
||||
|
@ -61,34 +61,34 @@ declare module 'discord-player' {
|
|||
autoSelfDeaf: boolean;
|
||||
quality: MusicQuality;
|
||||
}
|
||||
type Filters =
|
||||
| 'bassboost'
|
||||
| '8D'
|
||||
| 'vaporwave'
|
||||
type Filters =
|
||||
| 'bassboost'
|
||||
| '8D'
|
||||
| 'vaporwave'
|
||||
| 'nightcore'
|
||||
| 'phaser'
|
||||
| 'tremolo'
|
||||
| 'vibrato'
|
||||
| 'reverse'
|
||||
| 'treble'
|
||||
| 'normalizer'
|
||||
| 'surrounding'
|
||||
| 'pulsator'
|
||||
| 'subboost'
|
||||
| 'karaoke'
|
||||
| 'flanger'
|
||||
| 'gate'
|
||||
| 'haas'
|
||||
| 'mcompand'
|
||||
| 'mono'
|
||||
| 'mstlr'
|
||||
| 'mstrr'
|
||||
| 'compressor'
|
||||
| 'expander'
|
||||
| 'softlimiter'
|
||||
| 'chorus'
|
||||
| 'chorus2d'
|
||||
| 'chorus3d'
|
||||
| 'phaser'
|
||||
| 'tremolo'
|
||||
| 'vibrato'
|
||||
| 'reverse'
|
||||
| 'treble'
|
||||
| 'normalizer'
|
||||
| 'surrounding'
|
||||
| 'pulsator'
|
||||
| 'subboost'
|
||||
| 'karaoke'
|
||||
| 'flanger'
|
||||
| 'gate'
|
||||
| 'haas'
|
||||
| 'mcompand'
|
||||
| 'mono'
|
||||
| 'mstlr'
|
||||
| 'mstrr'
|
||||
| 'compressor'
|
||||
| 'expander'
|
||||
| 'softlimiter'
|
||||
| 'chorus'
|
||||
| 'chorus2d'
|
||||
| 'chorus3d'
|
||||
| 'fadein';
|
||||
|
||||
type FiltersStatuses = {
|
||||
|
@ -234,16 +234,6 @@ declare module 'discord-player' {
|
|||
avatar: string;
|
||||
};
|
||||
url: string;
|
||||
reactions: {
|
||||
total: number;
|
||||
like: number;
|
||||
love: number;
|
||||
care: number;
|
||||
wow: number;
|
||||
haha: number;
|
||||
sad: number;
|
||||
angry: number;
|
||||
};
|
||||
shares: string;
|
||||
views: string;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue