vdj 1.4.7 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/iService.d.ts +8 -8
- package/dist/core/iService.js +2 -2
- package/dist/core/index.d.ts +5 -5
- package/dist/core/index.js +10 -10
- package/dist/core/playlist.d.ts +24 -24
- package/dist/core/playlist.js +126 -126
- package/dist/core/song.d.ts +18 -19
- package/dist/core/song.js +16 -16
- package/dist/core/types.d.ts +39 -40
- package/dist/core/types.js +2 -2
- package/dist/default_implementations/youtube/service.d.ts +13 -13
- package/dist/default_implementations/youtube/service.js +112 -112
- package/dist/default_implementations/youtube/song.d.ts +19 -20
- package/dist/default_implementations/youtube/song.js +73 -73
- package/dist/default_implementations/youtubedl/service.d.ts +11 -11
- package/dist/default_implementations/youtubedl/service.js +77 -64
- package/dist/default_implementations/youtubedl/song.d.ts +13 -14
- package/dist/default_implementations/youtubedl/song.js +46 -46
- package/dist/index.d.ts +6 -6
- package/dist/index.js +17 -17
- package/package.json +5 -5
- package/src/default_implementations/youtube/service.ts +1 -1
- package/src/default_implementations/youtubedl/service.ts +14 -1
- package/test/test.js +1 -1
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
const core_1 = require("../../core");
|
|
13
|
-
const youtube_dl_exec_1 = require("youtube-dl-exec");
|
|
14
|
-
class YoutubedlSong extends core_1.Song {
|
|
15
|
-
constructor(service, url, logger) {
|
|
16
|
-
super(service);
|
|
17
|
-
this.type = 'youtubedl';
|
|
18
|
-
this.streamURL = url;
|
|
19
|
-
this.URL = url;
|
|
20
|
-
this.info = {
|
|
21
|
-
full: false,
|
|
22
|
-
metadataType: this.type,
|
|
23
|
-
url: this.URL
|
|
24
|
-
};
|
|
25
|
-
this.logger = logger;
|
|
26
|
-
}
|
|
27
|
-
getSongInfo() {
|
|
28
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
-
if (!this.info.full) {
|
|
30
|
-
this.info = yield this.service.getSongInfo(this.URL);
|
|
31
|
-
}
|
|
32
|
-
return this.info;
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
stream() {
|
|
36
|
-
const stream = youtube_dl_exec_1.exec(this.streamURL, {
|
|
37
|
-
output: '-',
|
|
38
|
-
format: 'bestaudio/best',
|
|
39
|
-
limitRate: '1M',
|
|
40
|
-
rmCacheDir: true,
|
|
41
|
-
verbose: true,
|
|
42
|
-
}, { stdio: ['ignore', 'pipe', 'ignore'] });
|
|
43
|
-
return stream.stdout;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
exports.default = YoutubedlSong;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const core_1 = require("../../core");
|
|
13
|
+
const youtube_dl_exec_1 = require("youtube-dl-exec");
|
|
14
|
+
class YoutubedlSong extends core_1.Song {
|
|
15
|
+
constructor(service, url, logger) {
|
|
16
|
+
super(service);
|
|
17
|
+
this.type = 'youtubedl';
|
|
18
|
+
this.streamURL = url;
|
|
19
|
+
this.URL = url;
|
|
20
|
+
this.info = {
|
|
21
|
+
full: false,
|
|
22
|
+
metadataType: this.type,
|
|
23
|
+
url: this.URL
|
|
24
|
+
};
|
|
25
|
+
this.logger = logger;
|
|
26
|
+
}
|
|
27
|
+
getSongInfo() {
|
|
28
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
if (!this.info.full) {
|
|
30
|
+
this.info = yield this.service.getSongInfo(this.URL);
|
|
31
|
+
}
|
|
32
|
+
return this.info;
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
stream() {
|
|
36
|
+
const stream = (0, youtube_dl_exec_1.exec)(this.streamURL, {
|
|
37
|
+
output: '-',
|
|
38
|
+
format: 'bestaudio/best',
|
|
39
|
+
limitRate: '1M',
|
|
40
|
+
rmCacheDir: true,
|
|
41
|
+
verbose: true,
|
|
42
|
+
}, { stdio: ['ignore', 'pipe', 'ignore'] });
|
|
43
|
+
return stream.stdout;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.default = YoutubedlSong;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Playlist, PlaylistSettings, IService, Song, SongInfo, PlaylistAddType, SearchType } from './core';
|
|
2
|
-
import YouTubeService from './default_implementations/youtube/service';
|
|
3
|
-
import YouTubeSong from './default_implementations/youtube/song';
|
|
4
|
-
import YoutubedlService from './default_implementations/youtubedl/service';
|
|
5
|
-
import YoutubedlSong from './default_implementations/youtubedl/song';
|
|
6
|
-
export { Playlist, PlaylistSettings, SearchType, PlaylistAddType, IService, Song, SongInfo, YouTubeService, YouTubeSong, YoutubedlService, YoutubedlSong, };
|
|
1
|
+
import { Playlist, PlaylistSettings, IService, Song, SongInfo, PlaylistAddType, SearchType } from './core';
|
|
2
|
+
import YouTubeService from './default_implementations/youtube/service';
|
|
3
|
+
import YouTubeSong from './default_implementations/youtube/song';
|
|
4
|
+
import YoutubedlService from './default_implementations/youtubedl/service';
|
|
5
|
+
import YoutubedlSong from './default_implementations/youtubedl/song';
|
|
6
|
+
export { Playlist, PlaylistSettings, SearchType, PlaylistAddType, IService, Song, SongInfo, YouTubeService, YouTubeSong, YoutubedlService, YoutubedlSong, };
|
package/dist/index.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.YoutubedlSong = exports.YoutubedlService = exports.YouTubeSong = exports.YouTubeService = exports.Song = exports.Playlist = void 0;
|
|
7
|
-
const core_1 = require("./core");
|
|
8
|
-
Object.defineProperty(exports, "Playlist", { enumerable: true, get: function () { return core_1.Playlist; } });
|
|
9
|
-
Object.defineProperty(exports, "Song", { enumerable: true, get: function () { return core_1.Song; } });
|
|
10
|
-
const service_1 = __importDefault(require("./default_implementations/youtube/service"));
|
|
11
|
-
exports.YouTubeService = service_1.default;
|
|
12
|
-
const song_1 = __importDefault(require("./default_implementations/youtube/song"));
|
|
13
|
-
exports.YouTubeSong = song_1.default;
|
|
14
|
-
const service_2 = __importDefault(require("./default_implementations/youtubedl/service"));
|
|
15
|
-
exports.YoutubedlService = service_2.default;
|
|
16
|
-
const song_2 = __importDefault(require("./default_implementations/youtubedl/song"));
|
|
17
|
-
exports.YoutubedlSong = song_2.default;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.YoutubedlSong = exports.YoutubedlService = exports.YouTubeSong = exports.YouTubeService = exports.Song = exports.Playlist = void 0;
|
|
7
|
+
const core_1 = require("./core");
|
|
8
|
+
Object.defineProperty(exports, "Playlist", { enumerable: true, get: function () { return core_1.Playlist; } });
|
|
9
|
+
Object.defineProperty(exports, "Song", { enumerable: true, get: function () { return core_1.Song; } });
|
|
10
|
+
const service_1 = __importDefault(require("./default_implementations/youtube/service"));
|
|
11
|
+
exports.YouTubeService = service_1.default;
|
|
12
|
+
const song_1 = __importDefault(require("./default_implementations/youtube/song"));
|
|
13
|
+
exports.YouTubeSong = song_1.default;
|
|
14
|
+
const service_2 = __importDefault(require("./default_implementations/youtubedl/service"));
|
|
15
|
+
exports.YoutubedlService = service_2.default;
|
|
16
|
+
const song_2 = __importDefault(require("./default_implementations/youtubedl/song"));
|
|
17
|
+
exports.YoutubedlSong = song_2.default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vdj",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -12,14 +12,14 @@
|
|
|
12
12
|
"devDependencies": {
|
|
13
13
|
"chai": "^4.2.0",
|
|
14
14
|
"dotenv": "^8.2.0",
|
|
15
|
-
"
|
|
16
|
-
"typescript": "^3.9.7"
|
|
15
|
+
"typescript": "^5.7.3"
|
|
17
16
|
},
|
|
18
17
|
"dependencies": {
|
|
18
|
+
"@distube/ytdl-core": "^4.16.4",
|
|
19
19
|
"@types/node": "^12.19.2",
|
|
20
20
|
"got": "^13.0.0",
|
|
21
|
+
"mocha": "^10.7.3",
|
|
21
22
|
"simple-youtube-api": "^5.2.1",
|
|
22
|
-
"youtube-dl-exec": "^
|
|
23
|
-
"ytdl-core": "^4.11.5"
|
|
23
|
+
"youtube-dl-exec": "^3.0.15"
|
|
24
24
|
}
|
|
25
25
|
}
|
|
@@ -21,6 +21,19 @@ export default class YoutubedlService implements IService {
|
|
|
21
21
|
|
|
22
22
|
public async getSongInfo(url: string, logger?: Logger): Promise<SongInfo> {
|
|
23
23
|
var res = await youtubedl(url, { dumpSingleJson: true, noCheckCertificates: true, addMetadata: true }, {});
|
|
24
|
+
if(typeof res === 'string') {
|
|
25
|
+
return {
|
|
26
|
+
full: true,
|
|
27
|
+
metadataType: "youtubedl",
|
|
28
|
+
imgURL: "",
|
|
29
|
+
title: url,
|
|
30
|
+
duration: 0,
|
|
31
|
+
url: url,
|
|
32
|
+
artist: [],
|
|
33
|
+
date: new Date(),
|
|
34
|
+
custom: {}
|
|
35
|
+
};
|
|
36
|
+
}
|
|
24
37
|
return {
|
|
25
38
|
full: true,
|
|
26
39
|
metadataType: "youtubedl",
|
|
@@ -28,7 +41,7 @@ export default class YoutubedlService implements IService {
|
|
|
28
41
|
title: res.title || url,
|
|
29
42
|
duration: res.duration,
|
|
30
43
|
url: url,
|
|
31
|
-
artist:
|
|
44
|
+
artist: [],
|
|
32
45
|
date: this.parseDate(res.upload_date),
|
|
33
46
|
custom: {}
|
|
34
47
|
};
|
package/test/test.js
CHANGED
|
@@ -128,7 +128,7 @@ describe("Playlist", function () {
|
|
|
128
128
|
title: "楽園ベイベー - RIP SLYME(Cover) / KMNZ",
|
|
129
129
|
duration: 282,
|
|
130
130
|
artist: ["KMNZ"],
|
|
131
|
-
date: new Date(
|
|
131
|
+
date: new Date(1566991937000),
|
|
132
132
|
};
|
|
133
133
|
const result = await youtubeService.getSongInfo(input, console.log);
|
|
134
134
|
sortOfDeepEqual(result, expected);
|