youtubei 0.0.1-rc.7 → 1.0.0-rc.1
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/LICENSE +21 -21
- package/README.md +50 -53
- package/dist/cjs/classes/Base/Base.js +10 -0
- package/dist/{index.js → cjs/classes/Base/index.js} +13 -13
- package/dist/cjs/classes/BaseChannel/BaseChannel.js +31 -0
- package/dist/cjs/classes/BaseChannel/BaseChannelParser.js +24 -0
- package/dist/cjs/classes/BaseChannel/ChannelPlaylists.js +57 -0
- package/dist/cjs/classes/BaseChannel/ChannelVideos.js +57 -0
- package/dist/{classes/client → cjs/classes/BaseChannel}/index.js +16 -19
- package/dist/cjs/classes/BaseVideo/BaseVideo.js +34 -0
- package/dist/cjs/classes/BaseVideo/BaseVideoParser.js +82 -0
- package/dist/cjs/classes/BaseVideo/VideoRelated.js +39 -0
- package/dist/{common → cjs/classes/BaseVideo}/index.js +15 -21
- package/dist/cjs/classes/Channel/Channel.js +24 -0
- package/dist/cjs/classes/Channel/ChannelParser.js +55 -0
- package/dist/cjs/classes/Channel/index.js +13 -0
- package/dist/cjs/classes/Chat/Chat.js +23 -0
- package/dist/cjs/classes/Chat/ChatParser.js +21 -0
- package/dist/cjs/classes/Chat/index.js +13 -0
- package/dist/cjs/classes/Client/Client.js +101 -0
- package/dist/cjs/classes/Client/HTTP.js +59 -0
- package/dist/cjs/classes/Client/index.js +13 -0
- package/dist/cjs/classes/Comment/Comment.js +29 -0
- package/dist/cjs/classes/Comment/CommentParser.js +43 -0
- package/dist/cjs/classes/Comment/CommentReplies.js +36 -0
- package/dist/cjs/classes/Comment/index.js +13 -0
- package/dist/cjs/classes/Continuable/Continuable.js +43 -0
- package/dist/cjs/classes/Continuable/index.js +13 -0
- package/dist/cjs/classes/LiveVideo/LiveVideo.js +84 -0
- package/dist/cjs/classes/LiveVideo/LiveVideoParser.js +29 -0
- package/dist/cjs/classes/LiveVideo/index.js +14 -0
- package/dist/cjs/classes/MixPlaylist/MixPlaylist.js +25 -0
- package/dist/cjs/classes/MixPlaylist/MixPlaylistParser.js +27 -0
- package/dist/cjs/classes/MixPlaylist/index.js +14 -0
- package/dist/cjs/classes/Playlist/Playlist.js +25 -0
- package/dist/cjs/classes/Playlist/PlaylistParser.js +83 -0
- package/dist/cjs/classes/Playlist/PlaylistVideos.js +50 -0
- package/dist/cjs/classes/Playlist/index.js +15 -0
- package/dist/cjs/classes/PlaylistCompact/PlaylistCompact.js +45 -0
- package/dist/cjs/classes/PlaylistCompact/PlaylistCompactParser.js +28 -0
- package/dist/cjs/classes/PlaylistCompact/index.js +14 -0
- package/dist/cjs/classes/Reply/Reply.js +23 -0
- package/dist/cjs/classes/Reply/ReplyParser.js +26 -0
- package/dist/cjs/classes/Reply/index.js +14 -0
- package/dist/cjs/classes/SearchManager/SearchManager.js +83 -0
- package/dist/cjs/classes/SearchManager/SearchManagerParser.js +40 -0
- package/dist/cjs/classes/SearchManager/index.js +14 -0
- package/dist/{common/types.js → cjs/classes/SearchManager/proto/SearchProto.js} +2 -2
- package/dist/cjs/classes/SearchManager/proto/index.js +57 -0
- package/dist/cjs/classes/Thumbnails/Thumbnails.js +67 -0
- package/dist/cjs/classes/Thumbnails/index.js +13 -0
- package/dist/cjs/classes/Video/Video.js +26 -0
- package/dist/cjs/classes/Video/VideoComments.js +53 -0
- package/dist/cjs/classes/Video/VideoParser.js +29 -0
- package/dist/cjs/classes/Video/index.js +14 -0
- package/dist/cjs/classes/VideoCompact/VideoCompact.js +49 -0
- package/dist/cjs/classes/VideoCompact/VideoCompactParser.js +36 -0
- package/dist/cjs/classes/VideoCompact/index.js +14 -0
- package/dist/cjs/classes/index.js +29 -0
- package/dist/{src → cjs}/common/decorators.js +14 -15
- package/dist/cjs/common/helper.js +45 -0
- package/dist/{src → cjs}/common/index.js +16 -21
- package/dist/cjs/common/mixins.js +14 -0
- package/dist/{classes/client → cjs/common}/types.js +2 -2
- package/dist/{src → cjs}/constants.js +10 -9
- package/dist/{src → cjs}/index.js +13 -13
- package/dist/esm/classes/Base/Base.js +8 -0
- package/dist/esm/classes/Base/index.js +1 -0
- package/dist/esm/classes/BaseChannel/BaseChannel.js +48 -0
- package/dist/esm/classes/BaseChannel/BaseChannelParser.js +24 -0
- package/dist/esm/classes/BaseChannel/ChannelPlaylists.js +109 -0
- package/dist/esm/classes/BaseChannel/ChannelVideos.js +109 -0
- package/dist/esm/classes/BaseChannel/index.js +4 -0
- package/dist/esm/classes/BaseVideo/BaseVideo.js +51 -0
- package/dist/esm/classes/BaseVideo/BaseVideoParser.js +93 -0
- package/dist/esm/classes/BaseVideo/VideoRelated.js +87 -0
- package/dist/esm/classes/BaseVideo/index.js +3 -0
- package/dist/esm/classes/Channel/Channel.js +37 -0
- package/dist/esm/classes/Channel/ChannelParser.js +77 -0
- package/dist/esm/classes/Channel/index.js +1 -0
- package/dist/esm/classes/Chat/Chat.js +36 -0
- package/dist/esm/classes/Chat/ChatParser.js +21 -0
- package/dist/esm/classes/Chat/index.js +1 -0
- package/dist/esm/classes/Client/Client.js +176 -0
- package/dist/esm/classes/Client/HTTP.js +112 -0
- package/dist/esm/classes/Client/index.js +1 -0
- package/dist/esm/classes/Comment/Comment.js +46 -0
- package/dist/esm/classes/Comment/CommentParser.js +45 -0
- package/dist/esm/classes/Comment/CommentReplies.js +84 -0
- package/dist/esm/classes/Comment/index.js +1 -0
- package/dist/esm/classes/Continuable/Continuable.js +125 -0
- package/dist/esm/classes/Continuable/index.js +1 -0
- package/dist/esm/classes/LiveVideo/LiveVideo.js +160 -0
- package/dist/esm/classes/LiveVideo/LiveVideoParser.js +29 -0
- package/dist/esm/classes/LiveVideo/index.js +2 -0
- package/dist/esm/classes/MixPlaylist/MixPlaylist.js +38 -0
- package/dist/esm/classes/MixPlaylist/MixPlaylistParser.js +49 -0
- package/dist/esm/classes/MixPlaylist/index.js +2 -0
- package/dist/esm/classes/Playlist/Playlist.js +38 -0
- package/dist/esm/classes/Playlist/PlaylistParser.js +105 -0
- package/dist/esm/classes/Playlist/PlaylistVideos.js +98 -0
- package/dist/esm/classes/Playlist/index.js +3 -0
- package/dist/esm/classes/PlaylistCompact/PlaylistCompact.js +90 -0
- package/dist/esm/classes/PlaylistCompact/PlaylistCompactParser.js +28 -0
- package/dist/esm/classes/PlaylistCompact/index.js +2 -0
- package/dist/esm/classes/Reply/Reply.js +36 -0
- package/dist/esm/classes/Reply/ReplyParser.js +26 -0
- package/dist/esm/classes/Reply/index.js +2 -0
- package/dist/esm/classes/SearchManager/SearchManager.js +159 -0
- package/dist/esm/classes/SearchManager/SearchManagerParser.js +62 -0
- package/dist/esm/classes/SearchManager/index.js +2 -0
- package/dist/esm/classes/SearchManager/proto/SearchProto.js +1 -0
- package/dist/esm/classes/SearchManager/proto/index.js +39 -0
- package/dist/esm/classes/Thumbnails/Thumbnails.js +109 -0
- package/dist/esm/classes/Thumbnails/index.js +1 -0
- package/dist/esm/classes/Video/Video.js +39 -0
- package/dist/esm/classes/Video/VideoComments.js +101 -0
- package/dist/esm/classes/Video/VideoParser.js +31 -0
- package/dist/esm/classes/Video/index.js +2 -0
- package/dist/esm/classes/VideoCompact/VideoCompact.js +98 -0
- package/dist/esm/classes/VideoCompact/VideoCompactParser.js +36 -0
- package/dist/esm/classes/VideoCompact/index.js +2 -0
- package/dist/esm/classes/index.js +17 -0
- package/dist/esm/common/decorators.js +30 -0
- package/dist/esm/common/helper.js +61 -0
- package/dist/{common/index.d.ts → esm/common/index.js} +4 -4
- package/dist/esm/common/mixins.js +10 -0
- package/dist/esm/common/types.js +1 -0
- package/dist/esm/constants.js +7 -0
- package/dist/{index.d.ts → esm/index.js} +1 -1
- package/dist/typings/classes/Base/Base.d.ts +11 -0
- package/dist/typings/classes/Base/index.d.ts +1 -0
- package/dist/typings/classes/BaseChannel/BaseChannel.d.ts +43 -0
- package/dist/typings/classes/BaseChannel/BaseChannelParser.d.ts +7 -0
- package/dist/typings/classes/BaseChannel/ChannelPlaylists.d.ts +30 -0
- package/dist/typings/classes/BaseChannel/ChannelVideos.d.ts +30 -0
- package/dist/typings/classes/BaseChannel/index.d.ts +4 -0
- package/dist/typings/classes/BaseVideo/BaseVideo.d.ts +59 -0
- package/dist/typings/classes/BaseVideo/BaseVideoParser.d.ts +14 -0
- package/dist/typings/classes/BaseVideo/VideoRelated.d.ts +21 -0
- package/dist/typings/classes/BaseVideo/index.d.ts +3 -0
- package/dist/typings/classes/Channel/Channel.d.ts +33 -0
- package/dist/typings/classes/Channel/ChannelParser.d.ts +6 -0
- package/dist/typings/classes/Channel/index.d.ts +1 -0
- package/dist/typings/classes/Chat/Chat.d.ts +33 -0
- package/dist/typings/classes/Chat/ChatParser.d.ts +5 -0
- package/dist/typings/classes/Chat/index.d.ts +1 -0
- package/dist/typings/classes/Client/Client.d.ts +41 -0
- package/dist/typings/classes/Client/HTTP.d.ts +21 -0
- package/dist/typings/classes/Client/index.d.ts +1 -0
- package/dist/typings/classes/Comment/Comment.d.ts +51 -0
- package/dist/typings/classes/Comment/CommentParser.d.ts +8 -0
- package/dist/typings/classes/Comment/CommentReplies.d.ts +17 -0
- package/dist/typings/classes/Comment/index.d.ts +1 -0
- package/dist/typings/classes/Continuable/Continuable.d.ts +24 -0
- package/dist/typings/classes/Continuable/index.d.ts +1 -0
- package/dist/typings/classes/LiveVideo/LiveVideo.d.ts +46 -0
- package/dist/typings/classes/LiveVideo/LiveVideoParser.d.ts +10 -0
- package/dist/typings/classes/LiveVideo/index.d.ts +2 -0
- package/dist/typings/classes/MixPlaylist/MixPlaylist.d.ts +29 -0
- package/dist/typings/classes/MixPlaylist/MixPlaylistParser.d.ts +6 -0
- package/dist/typings/classes/MixPlaylist/index.d.ts +2 -0
- package/dist/typings/classes/Playlist/Playlist.d.ts +39 -0
- package/dist/typings/classes/Playlist/PlaylistParser.d.ts +16 -0
- package/dist/typings/classes/Playlist/PlaylistVideos.d.ts +31 -0
- package/dist/typings/classes/Playlist/index.d.ts +3 -0
- package/dist/typings/classes/PlaylistCompact/PlaylistCompact.d.ts +43 -0
- package/dist/typings/classes/PlaylistCompact/PlaylistCompactParser.d.ts +5 -0
- package/dist/typings/classes/PlaylistCompact/index.d.ts +2 -0
- package/dist/typings/classes/Reply/Reply.d.ts +43 -0
- package/dist/typings/classes/Reply/ReplyParser.d.ts +5 -0
- package/dist/typings/classes/Reply/index.d.ts +2 -0
- package/dist/typings/classes/SearchManager/SearchManager.d.ts +51 -0
- package/dist/typings/classes/SearchManager/SearchManagerParser.d.ts +13 -0
- package/dist/typings/classes/SearchManager/index.d.ts +2 -0
- package/dist/typings/classes/SearchManager/proto/SearchProto.d.ts +13 -0
- package/dist/typings/classes/SearchManager/proto/index.d.ts +24 -0
- package/dist/typings/classes/Thumbnails/Thumbnails.d.ts +41 -0
- package/dist/typings/classes/Thumbnails/index.d.ts +1 -0
- package/dist/typings/classes/Video/Video.d.ts +24 -0
- package/dist/typings/classes/Video/VideoComments.d.ts +34 -0
- package/dist/typings/classes/Video/VideoParser.d.ts +8 -0
- package/dist/typings/classes/Video/index.d.ts +2 -0
- package/dist/typings/classes/VideoCompact/VideoCompact.d.ts +57 -0
- package/dist/typings/classes/VideoCompact/VideoCompactParser.d.ts +5 -0
- package/dist/typings/classes/VideoCompact/index.d.ts +2 -0
- package/dist/typings/classes/index.d.ts +17 -0
- package/dist/{src → typings}/common/decorators.d.ts +5 -7
- package/dist/typings/common/helper.d.ts +5 -0
- package/dist/{src → typings}/common/index.d.ts +4 -4
- package/dist/typings/common/mixins.d.ts +1 -0
- package/dist/{common → typings/common}/types.d.ts +1 -2
- package/dist/{constants.d.ts → typings/constants.d.ts} +7 -6
- package/dist/{src → typings}/index.d.ts +1 -1
- package/package.json +68 -53
- package/CHANGELOG.md +0 -6
- package/dist/classes/Base.d.ts +0 -8
- package/dist/classes/Base.js +0 -10
- package/dist/classes/Channel.d.ts +0 -63
- package/dist/classes/Channel.js +0 -115
- package/dist/classes/Comment.d.ts +0 -51
- package/dist/classes/Comment.js +0 -47
- package/dist/classes/LiveVideo.d.ts +0 -3
- package/dist/classes/LiveVideo.js +0 -12
- package/dist/classes/Playlist.d.ts +0 -66
- package/dist/classes/Playlist.js +0 -133
- package/dist/classes/PlaylistCompact.d.ts +0 -35
- package/dist/classes/PlaylistCompact.js +0 -47
- package/dist/classes/SearchResult.d.ts +0 -52
- package/dist/classes/SearchResult.js +0 -121
- package/dist/classes/Test.d.ts +0 -7
- package/dist/classes/Test.js +0 -9
- package/dist/classes/Thumbnails.d.ts +0 -23
- package/dist/classes/Thumbnails.js +0 -42
- package/dist/classes/Video.d.ts +0 -90
- package/dist/classes/Video.js +0 -153
- package/dist/classes/VideoCompact.d.ts +0 -46
- package/dist/classes/VideoCompact.js +0 -53
- package/dist/classes/client/Client.d.ts +0 -26
- package/dist/classes/client/Client.js +0 -63
- package/dist/classes/client/index.d.ts +0 -2
- package/dist/classes/client/types.d.ts +0 -12
- package/dist/classes/client.d.ts +0 -17
- package/dist/classes/client.js +0 -57
- package/dist/classes/index.d.ts +0 -10
- package/dist/classes/index.js +0 -26
- package/dist/common/decorators.d.ts +0 -7
- package/dist/common/decorators.js +0 -15
- package/dist/common/helper.d.ts +0 -4
- package/dist/common/helper.js +0 -39
- package/dist/common/http.d.ts +0 -33
- package/dist/common/http.js +0 -105
- package/dist/constants.js +0 -9
- package/dist/src/classes/Base.d.ts +0 -8
- package/dist/src/classes/Base.js +0 -10
- package/dist/src/classes/Channel.d.ts +0 -37
- package/dist/src/classes/Channel.js +0 -82
- package/dist/src/classes/Client.d.ts +0 -14
- package/dist/src/classes/Client.js +0 -51
- package/dist/src/classes/Comment.d.ts +0 -51
- package/dist/src/classes/Comment.js +0 -47
- package/dist/src/classes/Playlist.d.ts +0 -66
- package/dist/src/classes/Playlist.js +0 -133
- package/dist/src/classes/PlaylistCompact.d.ts +0 -35
- package/dist/src/classes/PlaylistCompact.js +0 -47
- package/dist/src/classes/SearchResult.d.ts +0 -53
- package/dist/src/classes/SearchResult.js +0 -122
- package/dist/src/classes/Thumbnails.d.ts +0 -24
- package/dist/src/classes/Thumbnails.js +0 -42
- package/dist/src/classes/Video.d.ts +0 -90
- package/dist/src/classes/Video.js +0 -153
- package/dist/src/classes/VideoCompact.d.ts +0 -46
- package/dist/src/classes/VideoCompact.js +0 -53
- package/dist/src/classes/index.d.ts +0 -10
- package/dist/src/classes/index.js +0 -26
- package/dist/src/common/helper.d.ts +0 -4
- package/dist/src/common/helper.js +0 -39
- package/dist/src/common/http.d.ts +0 -33
- package/dist/src/common/http.js +0 -105
- package/dist/src/common/types.d.ts +0 -2
- package/dist/src/common/types.js +0 -2
- package/dist/src/constants.d.ts +0 -6
- package/dist/tempCodeRunnerFile.d.ts +0 -8
- package/dist/tempCodeRunnerFile.js +0 -15
|
@@ -1,12 +0,0 @@
|
|
|
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
|
-
const _1 = require(".");
|
|
7
|
-
const util_1 = require("util");
|
|
8
|
-
const events_1 = __importDefault(require("events"));
|
|
9
|
-
class LiveVideo extends _1.Video {
|
|
10
|
-
}
|
|
11
|
-
exports.default = LiveVideo;
|
|
12
|
-
util_1.inherits(LiveVideo, events_1.default);
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { YoutubeRawData } from "../common";
|
|
2
|
-
import Channel from "./Channel";
|
|
3
|
-
import VideoCompact from "./VideoCompact";
|
|
4
|
-
/** @hidden */
|
|
5
|
-
interface PlaylistAttributes {
|
|
6
|
-
id: string;
|
|
7
|
-
title: string;
|
|
8
|
-
videoCount: number;
|
|
9
|
-
viewCount: number;
|
|
10
|
-
lastUpdatedAt: string;
|
|
11
|
-
channel?: Channel;
|
|
12
|
-
videos: VideoCompact[];
|
|
13
|
-
}
|
|
14
|
-
/** Represents a Playlist, usually returned from `client.getPlaylist()` */
|
|
15
|
-
export default class Playlist implements PlaylistAttributes {
|
|
16
|
-
/** The playlist's ID */
|
|
17
|
-
id: string;
|
|
18
|
-
/** The title of this playlist */
|
|
19
|
-
title: string;
|
|
20
|
-
/** How many videos in this playlist */
|
|
21
|
-
videoCount: number;
|
|
22
|
-
/** How many viewers does this playlist have */
|
|
23
|
-
viewCount: number;
|
|
24
|
-
/** Last time this playlist is updated */
|
|
25
|
-
lastUpdatedAt: string;
|
|
26
|
-
/** The channel that made this playlist */
|
|
27
|
-
channel?: Channel;
|
|
28
|
-
/** Videos in the playlist */
|
|
29
|
-
videos: VideoCompact[];
|
|
30
|
-
private _continuation;
|
|
31
|
-
/** @hidden */
|
|
32
|
-
constructor(playlist?: Partial<Playlist>);
|
|
33
|
-
/**
|
|
34
|
-
* Load instance attributes from youtube raw data
|
|
35
|
-
*
|
|
36
|
-
* @param youtubeRawData raw object from youtubei
|
|
37
|
-
* @hidden
|
|
38
|
-
*/
|
|
39
|
-
load(youtubeRawData: YoutubeRawData): Playlist;
|
|
40
|
-
/**
|
|
41
|
-
* Load next 100 videos of the playlist
|
|
42
|
-
*
|
|
43
|
-
* @example
|
|
44
|
-
* ```js
|
|
45
|
-
* const playlist = await youtube.getPlaylist(PLAYLIST_ID);
|
|
46
|
-
* console.log(playlist.videos) // first 100 videos
|
|
47
|
-
*
|
|
48
|
-
* let newVideos = await playlist.next();
|
|
49
|
-
* console.log(newVideos) // 100 loaded videos
|
|
50
|
-
* console.log(playlist.videos) // first 200 videos
|
|
51
|
-
*
|
|
52
|
-
* await playlist.next(0); // load the rest of the videos in the playlist
|
|
53
|
-
* ```
|
|
54
|
-
*
|
|
55
|
-
* @param count How many times to load the next videos. Set 0 to load all videos (might take a while on a large playlist!)
|
|
56
|
-
*/
|
|
57
|
-
next(count?: number): Promise<VideoCompact[]>;
|
|
58
|
-
/**
|
|
59
|
-
* Get compact videos
|
|
60
|
-
*
|
|
61
|
-
* @param playlistContents raw object from youtubei
|
|
62
|
-
*/
|
|
63
|
-
private static getVideos;
|
|
64
|
-
private static getSideBarInfo;
|
|
65
|
-
}
|
|
66
|
-
export {};
|
package/dist/classes/Playlist.js
DELETED
|
@@ -1,133 +0,0 @@
|
|
|
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
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
const _1 = require(".");
|
|
16
|
-
const common_1 = require("../common");
|
|
17
|
-
const constants_1 = require("../constants");
|
|
18
|
-
const Channel_1 = __importDefault(require("./Channel"));
|
|
19
|
-
const VideoCompact_1 = __importDefault(require("./VideoCompact"));
|
|
20
|
-
/** Represents a Playlist, usually returned from `client.getPlaylist()` */
|
|
21
|
-
class Playlist {
|
|
22
|
-
/** @hidden */
|
|
23
|
-
constructor(playlist = {}) {
|
|
24
|
-
Object.assign(this, playlist);
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Load instance attributes from youtube raw data
|
|
28
|
-
*
|
|
29
|
-
* @param youtubeRawData raw object from youtubei
|
|
30
|
-
* @hidden
|
|
31
|
-
*/
|
|
32
|
-
load(youtubeRawData) {
|
|
33
|
-
var _a, _b;
|
|
34
|
-
const sidebarRenderer = youtubeRawData.sidebar.playlistSidebarRenderer.items;
|
|
35
|
-
const primaryRenderer = sidebarRenderer[0].playlistSidebarPrimaryInfoRenderer;
|
|
36
|
-
// Basic information
|
|
37
|
-
this.id = primaryRenderer.title.runs[0].navigationEndpoint.watchEndpoint.playlistId;
|
|
38
|
-
this.title = primaryRenderer.title.runs[0].text;
|
|
39
|
-
const { stats } = primaryRenderer;
|
|
40
|
-
if (primaryRenderer.stats.length === 3) {
|
|
41
|
-
this.videoCount = Playlist.getSideBarInfo(stats[0], true);
|
|
42
|
-
this.viewCount = Playlist.getSideBarInfo(stats[1], true);
|
|
43
|
-
this.lastUpdatedAt = Playlist.getSideBarInfo(stats[2], false);
|
|
44
|
-
}
|
|
45
|
-
else if (stats.length === 2) {
|
|
46
|
-
this.videoCount = Playlist.getSideBarInfo(stats[0], true);
|
|
47
|
-
this.lastUpdatedAt = Playlist.getSideBarInfo(stats[1], false);
|
|
48
|
-
}
|
|
49
|
-
// Videos
|
|
50
|
-
const playlistContents = youtubeRawData.contents.twoColumnBrowseResultsRenderer.tabs[0].tabRenderer.content
|
|
51
|
-
.sectionListRenderer.contents[0].itemSectionRenderer.contents[0]
|
|
52
|
-
.playlistVideoListRenderer.contents;
|
|
53
|
-
const videos = Playlist.getVideos(playlistContents);
|
|
54
|
-
// Video Continuation Token
|
|
55
|
-
this._continuation = (_a = playlistContents[100]) === null || _a === void 0 ? void 0 : _a.continuationItemRenderer.continuationEndpoint.continuationCommand.token;
|
|
56
|
-
this.videos = videos;
|
|
57
|
-
// Channel
|
|
58
|
-
const videoOwner = ((_b = sidebarRenderer[1]) === null || _b === void 0 ? void 0 : _b.playlistSidebarSecondaryInfoRenderer.videoOwner) || undefined;
|
|
59
|
-
if (videoOwner) {
|
|
60
|
-
const { title, thumbnail } = videoOwner.videoOwnerRenderer;
|
|
61
|
-
this.channel = new Channel_1.default({
|
|
62
|
-
id: title.runs[0].navigationEndpoint.browseEndpoint.browseId,
|
|
63
|
-
name: title.runs[0].text,
|
|
64
|
-
thumbnails: new _1.Thumbnails().load(thumbnail.thumbnails),
|
|
65
|
-
url: "https://www.youtube.com" +
|
|
66
|
-
title.runs[0].navigationEndpoint.commandMetadata.webCommandMetadata.url,
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
return this;
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Load next 100 videos of the playlist
|
|
73
|
-
*
|
|
74
|
-
* @example
|
|
75
|
-
* ```js
|
|
76
|
-
* const playlist = await youtube.getPlaylist(PLAYLIST_ID);
|
|
77
|
-
* console.log(playlist.videos) // first 100 videos
|
|
78
|
-
*
|
|
79
|
-
* let newVideos = await playlist.next();
|
|
80
|
-
* console.log(newVideos) // 100 loaded videos
|
|
81
|
-
* console.log(playlist.videos) // first 200 videos
|
|
82
|
-
*
|
|
83
|
-
* await playlist.next(0); // load the rest of the videos in the playlist
|
|
84
|
-
* ```
|
|
85
|
-
*
|
|
86
|
-
* @param count How many times to load the next videos. Set 0 to load all videos (might take a while on a large playlist!)
|
|
87
|
-
*/
|
|
88
|
-
next(count = 1) {
|
|
89
|
-
var _a;
|
|
90
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
91
|
-
const newVideos = [];
|
|
92
|
-
for (let i = 0; i < count || count == 0; i++) {
|
|
93
|
-
if (!this._continuation)
|
|
94
|
-
break;
|
|
95
|
-
const response = yield common_1.http.post(`${constants_1.I_END_POINT}/browse`, {
|
|
96
|
-
data: { continuation: this._continuation },
|
|
97
|
-
});
|
|
98
|
-
const playlistContents = response.data.onResponseReceivedActions[0].appendContinuationItemsAction
|
|
99
|
-
.continuationItems;
|
|
100
|
-
newVideos.push(...Playlist.getVideos(playlistContents));
|
|
101
|
-
this._continuation = (_a = playlistContents[100]) === null || _a === void 0 ? void 0 : _a.continuationItemRenderer.continuationEndpoint.continuationCommand.token;
|
|
102
|
-
}
|
|
103
|
-
this.videos.push(...newVideos);
|
|
104
|
-
return newVideos;
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* Get compact videos
|
|
109
|
-
*
|
|
110
|
-
* @param playlistContents raw object from youtubei
|
|
111
|
-
*/
|
|
112
|
-
static getVideos(playlistContents) {
|
|
113
|
-
const videosRenderer = playlistContents.map((c) => c.playlistVideoRenderer);
|
|
114
|
-
const videos = [];
|
|
115
|
-
for (const videoRenderer of videosRenderer) {
|
|
116
|
-
if (!videoRenderer)
|
|
117
|
-
continue;
|
|
118
|
-
videos.push(new VideoCompact_1.default().load(videoRenderer));
|
|
119
|
-
}
|
|
120
|
-
return videos;
|
|
121
|
-
}
|
|
122
|
-
static getSideBarInfo(stats, parseInt) {
|
|
123
|
-
let data;
|
|
124
|
-
if ("runs" in stats)
|
|
125
|
-
data = stats.runs.map((r) => r.text).join("");
|
|
126
|
-
else
|
|
127
|
-
data = stats.simpleText.replace(/[^0-9]/g, "");
|
|
128
|
-
if (parseInt)
|
|
129
|
-
data = +data.replace(/[^0-9]/g, "");
|
|
130
|
-
return data;
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
exports.default = Playlist;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { Thumbnails } from ".";
|
|
2
|
-
import { YoutubeRawData } from "../common";
|
|
3
|
-
import Base from "./Base";
|
|
4
|
-
import Channel from "./Channel";
|
|
5
|
-
/** @hidden */
|
|
6
|
-
interface PlaylistCompactAttributes {
|
|
7
|
-
id: string;
|
|
8
|
-
title: string;
|
|
9
|
-
thumbnails: Thumbnails;
|
|
10
|
-
channel?: Channel;
|
|
11
|
-
videoCount: number;
|
|
12
|
-
}
|
|
13
|
-
/** Represents a Compact Playlist (e.g. from search result, upNext / related of a video) */
|
|
14
|
-
export default class PlaylistCompact extends Base implements PlaylistCompactAttributes {
|
|
15
|
-
/** The playlist's ID */
|
|
16
|
-
id: string;
|
|
17
|
-
/** The playlist's title */
|
|
18
|
-
title: string;
|
|
19
|
-
/** Thumbnails of the playlist with different sizes */
|
|
20
|
-
thumbnails: Thumbnails;
|
|
21
|
-
/** The channel that made this playlist */
|
|
22
|
-
channel?: Channel;
|
|
23
|
-
/** How many videos in this playlist */
|
|
24
|
-
videoCount: number;
|
|
25
|
-
/** @hidden */
|
|
26
|
-
constructor(playlist?: Partial<PlaylistCompactAttributes>);
|
|
27
|
-
/**
|
|
28
|
-
* Load instance attributes from youtube raw data
|
|
29
|
-
*
|
|
30
|
-
* @param youtubeRawData raw object from youtubei
|
|
31
|
-
* @hidden
|
|
32
|
-
*/
|
|
33
|
-
load(youtubeRawData: YoutubeRawData): PlaylistCompact;
|
|
34
|
-
}
|
|
35
|
-
export {};
|
|
@@ -1,47 +0,0 @@
|
|
|
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
|
-
const _1 = require(".");
|
|
7
|
-
const Base_1 = __importDefault(require("./Base"));
|
|
8
|
-
const Channel_1 = __importDefault(require("./Channel"));
|
|
9
|
-
/** Represents a Compact Playlist (e.g. from search result, upNext / related of a video) */
|
|
10
|
-
class PlaylistCompact extends Base_1.default {
|
|
11
|
-
/** @hidden */
|
|
12
|
-
constructor(playlist = {}) {
|
|
13
|
-
super();
|
|
14
|
-
Object.assign(this, playlist);
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Load instance attributes from youtube raw data
|
|
18
|
-
*
|
|
19
|
-
* @param youtubeRawData raw object from youtubei
|
|
20
|
-
* @hidden
|
|
21
|
-
*/
|
|
22
|
-
load(youtubeRawData) {
|
|
23
|
-
var _a;
|
|
24
|
-
const { playlistId, title, thumbnail, shortBylineText, videoCount, videoCountShortText, } = youtubeRawData;
|
|
25
|
-
this.id = playlistId;
|
|
26
|
-
this.title = title.simpleText || title.runs[0].text;
|
|
27
|
-
this.videoCount =
|
|
28
|
-
+((_a = (videoCount !== null && videoCount !== void 0 ? videoCount : videoCountShortText.simpleText)) === null || _a === void 0 ? void 0 : _a.replace(/[^0-9]/g, "")) || 0;
|
|
29
|
-
// Thumbnail
|
|
30
|
-
let { thumbnails } = youtubeRawData;
|
|
31
|
-
if (!thumbnails)
|
|
32
|
-
thumbnails = thumbnail.thumbnails;
|
|
33
|
-
else
|
|
34
|
-
thumbnails = thumbnails[0].thumbnails;
|
|
35
|
-
this.thumbnails = new _1.Thumbnails().load(thumbnails);
|
|
36
|
-
// Channel
|
|
37
|
-
if (shortBylineText && shortBylineText.simpleText !== "YouTube") {
|
|
38
|
-
this.channel = new Channel_1.default({
|
|
39
|
-
id: shortBylineText.runs[0].navigationEndpoint.browseEndpoint.browseId,
|
|
40
|
-
name: shortBylineText.runs[0].text,
|
|
41
|
-
url: `https://www.youtube.com${shortBylineText.runs[0].navigationEndpoint.commandMetadata.webCommandMetadata.url}`,
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
return this;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
exports.default = PlaylistCompact;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { SearchOptions } from "./Client";
|
|
2
|
-
import { Channel, PlaylistCompact, VideoCompact } from "..";
|
|
3
|
-
export declare type SearchResultType<T> = T extends {
|
|
4
|
-
type: "video";
|
|
5
|
-
} ? VideoCompact : T extends {
|
|
6
|
-
type: "channel";
|
|
7
|
-
} ? Channel : T extends {
|
|
8
|
-
type: "playlist";
|
|
9
|
-
} ? PlaylistCompact : VideoCompact | Channel | PlaylistCompact;
|
|
10
|
-
/**
|
|
11
|
-
* Represents search result, usually returned from `client.search();`
|
|
12
|
-
*
|
|
13
|
-
* @noInheritDoc
|
|
14
|
-
*/
|
|
15
|
-
export default class SearchResult<T> extends Array<SearchResultType<T>> {
|
|
16
|
-
private _continuation;
|
|
17
|
-
/** @hidden */
|
|
18
|
-
constructor();
|
|
19
|
-
/**
|
|
20
|
-
* Initialize data from search
|
|
21
|
-
*
|
|
22
|
-
* @param query Search query
|
|
23
|
-
* @param options Search Options
|
|
24
|
-
* @hidden
|
|
25
|
-
*/
|
|
26
|
-
init(query: string, options: SearchOptions): Promise<SearchResult<T>>;
|
|
27
|
-
/**
|
|
28
|
-
* Load next search data. Youtube returns inconsistent amount of search result, it usually varies from 18 to 20
|
|
29
|
-
*
|
|
30
|
-
* @example
|
|
31
|
-
* ```js
|
|
32
|
-
* const videos = await youtube.search("keyword", { type: "video" });
|
|
33
|
-
* console.log(videos) // first 18-20 videos from the search result
|
|
34
|
-
*
|
|
35
|
-
* let newVideos = await videos.next();
|
|
36
|
-
* console.log(newVideos) // 18-20 loaded videos
|
|
37
|
-
* console.log(videos) // 36-40 first videos from the search result
|
|
38
|
-
* ```
|
|
39
|
-
*
|
|
40
|
-
* @param count How many times to load the next data
|
|
41
|
-
*/
|
|
42
|
-
next(count?: number): Promise<Array<SearchResultType<T>>>;
|
|
43
|
-
/** Load videos data from youtube */
|
|
44
|
-
private loadSearchResult;
|
|
45
|
-
/**
|
|
46
|
-
* Get type query value
|
|
47
|
-
*
|
|
48
|
-
* @param type Search type
|
|
49
|
-
* @hidden
|
|
50
|
-
*/
|
|
51
|
-
static getSearchTypeParam(type: "video" | "playlist" | "channel" | "all"): string;
|
|
52
|
-
}
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
9
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
10
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
11
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
12
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
13
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
14
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
15
|
-
});
|
|
16
|
-
};
|
|
17
|
-
var SearchResult_1;
|
|
18
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
const constants_1 = require("../constants");
|
|
20
|
-
const common_1 = require("../common");
|
|
21
|
-
const __1 = require("..");
|
|
22
|
-
/**
|
|
23
|
-
* Represents search result, usually returned from `client.search();`
|
|
24
|
-
*
|
|
25
|
-
* @noInheritDoc
|
|
26
|
-
*/
|
|
27
|
-
let SearchResult = SearchResult_1 = class SearchResult extends Array {
|
|
28
|
-
/** @hidden */
|
|
29
|
-
constructor() {
|
|
30
|
-
super();
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Initialize data from search
|
|
34
|
-
*
|
|
35
|
-
* @param query Search query
|
|
36
|
-
* @param options Search Options
|
|
37
|
-
* @hidden
|
|
38
|
-
*/
|
|
39
|
-
init(query, options) {
|
|
40
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
41
|
-
const response = yield common_1.http.post(`${constants_1.I_END_POINT}/search`, {
|
|
42
|
-
data: { query, params: SearchResult_1.getSearchTypeParam(options.type) },
|
|
43
|
-
});
|
|
44
|
-
this.loadSearchResult(response.data.contents.twoColumnSearchResultsRenderer.primaryContents
|
|
45
|
-
.sectionListRenderer.contents);
|
|
46
|
-
return this;
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Load next search data. Youtube returns inconsistent amount of search result, it usually varies from 18 to 20
|
|
51
|
-
*
|
|
52
|
-
* @example
|
|
53
|
-
* ```js
|
|
54
|
-
* const videos = await youtube.search("keyword", { type: "video" });
|
|
55
|
-
* console.log(videos) // first 18-20 videos from the search result
|
|
56
|
-
*
|
|
57
|
-
* let newVideos = await videos.next();
|
|
58
|
-
* console.log(newVideos) // 18-20 loaded videos
|
|
59
|
-
* console.log(videos) // 36-40 first videos from the search result
|
|
60
|
-
* ```
|
|
61
|
-
*
|
|
62
|
-
* @param count How many times to load the next data
|
|
63
|
-
*/
|
|
64
|
-
next(count = 1) {
|
|
65
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
66
|
-
const newSearchResults = [];
|
|
67
|
-
for (let i = 0; i < count; i++) {
|
|
68
|
-
if (!this._continuation)
|
|
69
|
-
break;
|
|
70
|
-
const response = yield common_1.http.post(`${constants_1.I_END_POINT}/search`, {
|
|
71
|
-
data: { continuation: this._continuation },
|
|
72
|
-
});
|
|
73
|
-
newSearchResults.push(...this.loadSearchResult(response.data.onResponseReceivedCommands[0].appendContinuationItemsAction
|
|
74
|
-
.continuationItems));
|
|
75
|
-
}
|
|
76
|
-
this.push(...newSearchResults);
|
|
77
|
-
return newSearchResults;
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
/** Load videos data from youtube */
|
|
81
|
-
loadSearchResult(sectionListContents) {
|
|
82
|
-
var _a, _b;
|
|
83
|
-
const contents = sectionListContents
|
|
84
|
-
.filter((c) => "itemSectionRenderer" in c)
|
|
85
|
-
.pop().itemSectionRenderer.contents;
|
|
86
|
-
const continuationToken = (_b = (_a = sectionListContents
|
|
87
|
-
.filter((c) => "continuationItemRenderer" in c)
|
|
88
|
-
.pop().continuationItemRenderer) === null || _a === void 0 ? void 0 : _a.continuationEndpoint) === null || _b === void 0 ? void 0 : _b.continuationCommand.token;
|
|
89
|
-
this._continuation = continuationToken;
|
|
90
|
-
const newContent = [];
|
|
91
|
-
for (const content of contents) {
|
|
92
|
-
if ("playlistRenderer" in content)
|
|
93
|
-
newContent.push(new __1.PlaylistCompact().load(content.playlistRenderer));
|
|
94
|
-
else if ("videoRenderer" in content)
|
|
95
|
-
newContent.push(new __1.VideoCompact().load(content.videoRenderer));
|
|
96
|
-
else if ("channelRenderer" in content)
|
|
97
|
-
newContent.push(new __1.Channel().load(content.channelRenderer));
|
|
98
|
-
}
|
|
99
|
-
this.push(...newContent);
|
|
100
|
-
return newContent;
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* Get type query value
|
|
104
|
-
*
|
|
105
|
-
* @param type Search type
|
|
106
|
-
* @hidden
|
|
107
|
-
*/
|
|
108
|
-
static getSearchTypeParam(type) {
|
|
109
|
-
const searchType = {
|
|
110
|
-
video: "EgIQAQ%3D%3D",
|
|
111
|
-
playlist: "EgIQAw%3D%3D",
|
|
112
|
-
channel: "EgIQAg%3D%3D",
|
|
113
|
-
all: "",
|
|
114
|
-
};
|
|
115
|
-
return type in searchType ? searchType[type] : "";
|
|
116
|
-
}
|
|
117
|
-
};
|
|
118
|
-
SearchResult = SearchResult_1 = __decorate([
|
|
119
|
-
common_1.extendsBuiltIn()
|
|
120
|
-
], SearchResult);
|
|
121
|
-
exports.default = SearchResult;
|
package/dist/classes/Test.d.ts
DELETED
package/dist/classes/Test.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
interface Thumbnail {
|
|
2
|
-
url: string;
|
|
3
|
-
width: number;
|
|
4
|
-
height: number;
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* Represents Thumbnails, usually found inside Playlist / Channel / Video, etc.
|
|
8
|
-
*
|
|
9
|
-
* @noInheritDoc
|
|
10
|
-
*/
|
|
11
|
-
export default class Thumbnails extends Array<Thumbnail> {
|
|
12
|
-
/** @hidden */
|
|
13
|
-
constructor();
|
|
14
|
-
/**
|
|
15
|
-
* Load instance attributes from youtube raw data
|
|
16
|
-
*
|
|
17
|
-
* @hidden
|
|
18
|
-
*/
|
|
19
|
-
load(thumbnails: Thumbnail[]): Thumbnails;
|
|
20
|
-
/** Returns thumbnail with the highest resolution */
|
|
21
|
-
get best(): string;
|
|
22
|
-
}
|
|
23
|
-
export {};
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
const common_1 = require("../common");
|
|
10
|
-
/**
|
|
11
|
-
* Represents Thumbnails, usually found inside Playlist / Channel / Video, etc.
|
|
12
|
-
*
|
|
13
|
-
* @noInheritDoc
|
|
14
|
-
*/
|
|
15
|
-
let Thumbnails = class Thumbnails extends Array {
|
|
16
|
-
/** @hidden */
|
|
17
|
-
constructor() {
|
|
18
|
-
super();
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Load instance attributes from youtube raw data
|
|
22
|
-
*
|
|
23
|
-
* @hidden
|
|
24
|
-
*/
|
|
25
|
-
load(thumbnails) {
|
|
26
|
-
this.push(...thumbnails);
|
|
27
|
-
return this;
|
|
28
|
-
}
|
|
29
|
-
/** Returns thumbnail with the highest resolution */
|
|
30
|
-
get best() {
|
|
31
|
-
const thumbnail = this[this.length - 1].url;
|
|
32
|
-
if (thumbnail.startsWith("//"))
|
|
33
|
-
return `https:${thumbnail}`;
|
|
34
|
-
if (!thumbnail.startsWith("https://"))
|
|
35
|
-
return `https://${thumbnail}`;
|
|
36
|
-
return thumbnail;
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
Thumbnails = __decorate([
|
|
40
|
-
common_1.extendsBuiltIn()
|
|
41
|
-
], Thumbnails);
|
|
42
|
-
exports.default = Thumbnails;
|
package/dist/classes/Video.d.ts
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import { PlaylistCompact, VideoCompact, Channel, Base, Comment, Thumbnails } from ".";
|
|
2
|
-
import { YoutubeRawData } from "../common";
|
|
3
|
-
/**
|
|
4
|
-
* @hidden
|
|
5
|
-
* @ignore
|
|
6
|
-
* @internal
|
|
7
|
-
*/
|
|
8
|
-
interface VideoAttributes {
|
|
9
|
-
id: string;
|
|
10
|
-
title: string;
|
|
11
|
-
duration: number | null;
|
|
12
|
-
thumbnails: Thumbnails;
|
|
13
|
-
description: string;
|
|
14
|
-
channel: Channel;
|
|
15
|
-
uploadDate: string;
|
|
16
|
-
viewCount: number | null;
|
|
17
|
-
likeCount: number | null;
|
|
18
|
-
dislikeCount: number | null;
|
|
19
|
-
isLiveContent: boolean;
|
|
20
|
-
tags: string[];
|
|
21
|
-
upNext: VideoCompact | PlaylistCompact;
|
|
22
|
-
related: (VideoCompact | PlaylistCompact)[];
|
|
23
|
-
comments: Comment[];
|
|
24
|
-
}
|
|
25
|
-
/** Represents a Video, usually returned from `client.getVideo()` */
|
|
26
|
-
export default class Video extends Base implements VideoAttributes {
|
|
27
|
-
/** The video's ID */
|
|
28
|
-
id: string;
|
|
29
|
-
/** The title of this video */
|
|
30
|
-
title: string;
|
|
31
|
-
/** The duration of this video in second, null if the video is live */
|
|
32
|
-
duration: number | null;
|
|
33
|
-
/** Thumbnails of the video with different sizes */
|
|
34
|
-
thumbnails: Thumbnails;
|
|
35
|
-
/** The description of this video */
|
|
36
|
-
description: string;
|
|
37
|
-
/** The channel who uploads this video */
|
|
38
|
-
channel: Channel;
|
|
39
|
-
/** The date this video is uploaded at */
|
|
40
|
-
uploadDate: string;
|
|
41
|
-
/** How many view does this video have, null if the view count is hidden */
|
|
42
|
-
viewCount: number | null;
|
|
43
|
-
/** How many like does this video have, null if the like count hidden */
|
|
44
|
-
likeCount: number | null;
|
|
45
|
-
/** How many dislike does this video have, null if the dislike count is hidden */
|
|
46
|
-
dislikeCount: number | null;
|
|
47
|
-
/** Whether this video is a live content or not */
|
|
48
|
-
isLiveContent: boolean;
|
|
49
|
-
/** The tags of this video */
|
|
50
|
-
tags: string[];
|
|
51
|
-
/** Next video / playlist recommended by Youtube */
|
|
52
|
-
upNext: VideoCompact | PlaylistCompact;
|
|
53
|
-
/** Videos / playlists related to this video */
|
|
54
|
-
related: (VideoCompact | PlaylistCompact)[];
|
|
55
|
-
/**
|
|
56
|
-
* Comments of this video
|
|
57
|
-
*
|
|
58
|
-
* You need to load the comment first by calling `video.nextComments()` as youtube doesn't send any comments data when loading the video (from `client.getVideo()`)
|
|
59
|
-
*/
|
|
60
|
-
comments: Comment[];
|
|
61
|
-
private _commentContinuation?;
|
|
62
|
-
/** @hidden */
|
|
63
|
-
constructor(video?: Partial<VideoAttributes>);
|
|
64
|
-
/**
|
|
65
|
-
* Load instance attributes from youtube raw data
|
|
66
|
-
*
|
|
67
|
-
* @param youtubeRawData raw object from youtubei
|
|
68
|
-
* @hidden
|
|
69
|
-
*/
|
|
70
|
-
load(youtubeRawData: YoutubeRawData): Video;
|
|
71
|
-
/**
|
|
72
|
-
* Load next 20 comments of the video
|
|
73
|
-
*
|
|
74
|
-
* @example
|
|
75
|
-
* ```js
|
|
76
|
-
* const video = await youtube.getVideo(VIDEO_ID);
|
|
77
|
-
* console.log(video.comments) // first 20 comments
|
|
78
|
-
*
|
|
79
|
-
* let newComments = await video.nextComments();
|
|
80
|
-
* console.log(newComments) // 20 loaded comments
|
|
81
|
-
* console.log(video.comments) // first 40 comments
|
|
82
|
-
*
|
|
83
|
-
* await video.nextComments(0); // load the rest of the comments in the playlist
|
|
84
|
-
* ```
|
|
85
|
-
*
|
|
86
|
-
* @param count How many times to load the next comments. Set 0 to load all comments (might take a while on a video with many comments!)
|
|
87
|
-
*/
|
|
88
|
-
nextComments(count?: number): Promise<Comment[]>;
|
|
89
|
-
}
|
|
90
|
-
export {};
|