vdj 1.4.7 → 1.5.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.
@@ -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.4.7",
3
+ "version": "1.5.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
- "mocha": "^10.2.0",
16
15
  "typescript": "^3.9.7"
17
16
  },
18
17
  "dependencies": {
19
18
  "@types/node": "^12.19.2",
20
19
  "got": "^13.0.0",
20
+ "mocha": "^10.7.3",
21
21
  "simple-youtube-api": "^5.2.1",
22
- "youtube-dl-exec": "^2.4.7",
22
+ "youtube-dl-exec": "^3.0.7",
23
23
  "ytdl-core": "^4.11.5"
24
24
  }
25
25
  }
@@ -20,7 +20,7 @@ export default class YoutubedlService implements IService {
20
20
  }
21
21
 
22
22
  public async getSongInfo(url: string, logger?: Logger): Promise<SongInfo> {
23
- var res = await youtubedl(url, { dumpSingleJson: true, noCheckCertificates: true, addMetadata: true }, {});
23
+ var res = await youtubedl(url, { dumpSingleJson: true, noCheckCertificates: true, addMetadata: true }, {});
24
24
  return {
25
25
  full: true,
26
26
  metadataType: "youtubedl",
@@ -28,7 +28,7 @@ export default class YoutubedlService implements IService {
28
28
  title: res.title || url,
29
29
  duration: res.duration,
30
30
  url: url,
31
- artist: res.artist ? [res.artist] : [],
31
+ artist: [],
32
32
  date: this.parseDate(res.upload_date),
33
33
  custom: {}
34
34
  };
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(1566950400000),
131
+ date: new Date(1566991937000),
132
132
  };
133
133
  const result = await youtubeService.getSongInfo(input, console.log);
134
134
  sortOfDeepEqual(result, expected);
@@ -171,19 +171,26 @@ describe("Playlist", function () {
171
171
  });
172
172
  describe("#getSongInfo", function () {
173
173
  this.timeout(5000);
174
+ console.log("hey");
174
175
  it("should return a lot more information from working youtube link", async function () {
175
- const input = "https://www.youtube.com/watch?v=232fF5ECnGo";
176
- const expected = {
177
- full: true,
178
- metadataType: "youtubedl",
179
- url: input,
180
- title: "Rap God in the style of @LinkinPark​ (Feat. @jonathanymusic)",
181
- duration: 371,
182
- artist: [],
183
- date: new Date(1660773600000),
184
- };
185
- const result = await youtubedlService.getSongInfo(input, console.log);
186
- sortOfDeepEqual(result, expected);
176
+ try {
177
+ const input = "https://www.youtube.com/watch?v=232fF5ECnGo";
178
+ const expected = {
179
+ full: true,
180
+ metadataType: "youtubedl",
181
+ url: input,
182
+ title: "Rap God in the style of @LinkinPark​ (Feat. @jonathanymusic)",
183
+ duration: 371,
184
+ artist: [],
185
+ date: new Date(1660773600000),
186
+ };
187
+ var tes = new vdj.YoutubedlService();
188
+ const result = await tes.getSongInfo(input, console.log);
189
+ sortOfDeepEqual(result, expected);
190
+ }
191
+ catch (e) {
192
+ console.log(e);
193
+ }
187
194
  });
188
195
  });
189
196
  describe("#getSongInfo", function () {