youtubei 1.2.0 → 1.2.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/dist/cjs/youtube/BaseChannel/ChannelLive.js +3 -3
- package/dist/cjs/youtube/BaseChannel/ChannelShorts.js +7 -7
- package/dist/cjs/youtube/BaseChannel/index.js +2 -0
- package/dist/cjs/youtube/BaseVideo/BaseVideoParser.js +1 -1
- package/dist/cjs/youtube/Client/Client.js +1 -1
- package/dist/cjs/youtube/SearchResult/SearchResult.js +1 -1
- package/dist/cjs/youtube/SearchResult/proto/index.js +5 -5
- package/dist/cjs/youtube/Transcript/proto/TranscriptParamsProto.js +3 -3
- package/dist/esm/youtube/BaseChannel/ChannelLive.js +3 -3
- package/dist/esm/youtube/BaseChannel/ChannelShorts.js +7 -7
- package/dist/esm/youtube/BaseChannel/index.js +2 -0
- package/dist/esm/youtube/BaseVideo/BaseVideoParser.js +1 -1
- package/dist/esm/youtube/Client/Client.js +1 -1
- package/dist/esm/youtube/SearchResult/SearchResult.js +1 -1
- package/dist/esm/youtube/SearchResult/proto/index.js +2 -2
- package/dist/esm/youtube/Transcript/proto/TranscriptParamsProto.js +2 -2
- package/dist/typings/youtube/BaseChannel/ChannelLive.d.ts +4 -4
- package/dist/typings/youtube/BaseChannel/ChannelShorts.d.ts +8 -8
- package/dist/typings/youtube/BaseChannel/index.d.ts +2 -0
- package/dist/typings/youtube/SearchResult/proto/index.d.ts +2 -41
- package/dist/typings/youtube/Transcript/proto/TranscriptParamsProto.d.ts +2 -11
- package/package.json +2 -2
|
@@ -24,11 +24,11 @@ const BaseChannelParser_1 = require("./BaseChannelParser");
|
|
|
24
24
|
* await channel.live.next();
|
|
25
25
|
* console.log(channel.live.items) // first 30 live videos
|
|
26
26
|
*
|
|
27
|
-
* let
|
|
28
|
-
* console.log(
|
|
27
|
+
* let newLives = await channel.videos.next();
|
|
28
|
+
* console.log(newLives) // 30 loaded live videos
|
|
29
29
|
* console.log(channel.live.items) // first 60 live videos
|
|
30
30
|
*
|
|
31
|
-
* await channel.live.next(0); // load the rest of the videos in the channel
|
|
31
|
+
* await channel.live.next(0); // load the rest of the live videos in the channel
|
|
32
32
|
* ```
|
|
33
33
|
*/
|
|
34
34
|
class ChannelLive extends Continuable_1.Continuable {
|
|
@@ -16,19 +16,19 @@ const VideoCompact_1 = require("../VideoCompact");
|
|
|
16
16
|
const constants_1 = require("../constants");
|
|
17
17
|
const BaseChannelParser_1 = require("./BaseChannelParser");
|
|
18
18
|
/**
|
|
19
|
-
* {@link Continuable} of
|
|
19
|
+
* {@link Continuable} of shorts inside a {@link BaseChannel}
|
|
20
20
|
*
|
|
21
21
|
* @example
|
|
22
22
|
* ```js
|
|
23
23
|
* const channel = await youtube.findOne(CHANNEL_NAME, {type: "channel"});
|
|
24
|
-
* await channel.
|
|
25
|
-
* console.log(channel.
|
|
24
|
+
* await channel.short.next();
|
|
25
|
+
* console.log(channel.short.items) // first 30 shorts
|
|
26
26
|
*
|
|
27
|
-
* let
|
|
28
|
-
* console.log(
|
|
29
|
-
* console.log(channel.
|
|
27
|
+
* let newShorts = await channel.short.next();
|
|
28
|
+
* console.log(newShorts) // 30 loaded shorts
|
|
29
|
+
* console.log(channel.short.items) // first 60 shorts
|
|
30
30
|
*
|
|
31
|
-
* await channel.
|
|
31
|
+
* await channel.short.next(0); // load the rest of the shorts in the channel
|
|
32
32
|
* ```
|
|
33
33
|
*/
|
|
34
34
|
class ChannelShorts extends Continuable_1.Continuable {
|
|
@@ -12,5 +12,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
__exportStar(require("./BaseChannel"), exports);
|
|
14
14
|
__exportStar(require("./BaseChannelParser"), exports);
|
|
15
|
+
__exportStar(require("./ChannelLive"), exports);
|
|
15
16
|
__exportStar(require("./ChannelPlaylists"), exports);
|
|
17
|
+
__exportStar(require("./ChannelShorts"), exports);
|
|
16
18
|
__exportStar(require("./ChannelVideos"), exports);
|
|
@@ -31,7 +31,7 @@ class BaseVideoParser {
|
|
|
31
31
|
// Tags and description
|
|
32
32
|
target.tags =
|
|
33
33
|
((_b = (_a = videoInfo.superTitleLink) === null || _a === void 0 ? void 0 : _a.runs) === null || _b === void 0 ? void 0 : _b.map((r) => r.text.trim()).filter((t) => t)) || [];
|
|
34
|
-
target.description = videoInfo.shortDescription || "";
|
|
34
|
+
target.description = videoInfo.videoDetails.shortDescription || "";
|
|
35
35
|
// related videos
|
|
36
36
|
const secondaryContents = data[3].response.contents.twoColumnWatchNextResults.secondaryResults.secondaryResults
|
|
37
37
|
.results;
|
|
@@ -100,7 +100,7 @@ class Client {
|
|
|
100
100
|
}
|
|
101
101
|
getVideoTranscript(videoId) {
|
|
102
102
|
return __awaiter(this, void 0, void 0, function* () {
|
|
103
|
-
const bufferParams = Transcript_1.TranscriptParamsProto.
|
|
103
|
+
const bufferParams = Transcript_1.TranscriptParamsProto.encode({ videoId }).finish();
|
|
104
104
|
const response = yield this.http.post(`${constants_1.I_END_POINT}/get_transcript`, {
|
|
105
105
|
data: { params: Buffer.from(bufferParams).toString("base64") },
|
|
106
106
|
});
|
|
@@ -101,7 +101,7 @@ class SearchResult extends Continuable_1.Continuable {
|
|
|
101
101
|
return __awaiter(this, void 0, void 0, function* () {
|
|
102
102
|
this.items = [];
|
|
103
103
|
this.estimatedResults = 0;
|
|
104
|
-
const bufferParams = proto_1.SearchProto.
|
|
104
|
+
const bufferParams = proto_1.SearchProto.encode(proto_1.optionsToProto(options)).finish();
|
|
105
105
|
const response = yield this.client.http.post(`${constants_1.I_END_POINT}/search`, {
|
|
106
106
|
data: {
|
|
107
107
|
query,
|
|
@@ -4,9 +4,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.optionsToProto = exports.SearchProto = void 0;
|
|
7
|
-
const
|
|
7
|
+
const protobufjs_1 = __importDefault(require("protobufjs"));
|
|
8
8
|
// TODO move this to .proto file
|
|
9
|
-
exports.SearchProto =
|
|
9
|
+
exports.SearchProto = protobufjs_1.default.parse(`
|
|
10
10
|
message SearchOptions {
|
|
11
11
|
message Options {
|
|
12
12
|
optional int32 uploadDate = 1;
|
|
@@ -16,8 +16,8 @@ exports.SearchProto = protocol_buffers_1.default(`
|
|
|
16
16
|
optional int32 subtitles = 5;
|
|
17
17
|
optional int32 creativeCommons = 6;
|
|
18
18
|
optional int32 live = 8;
|
|
19
|
-
optional int32
|
|
20
|
-
optional int32
|
|
19
|
+
optional int32 _4k = 14;
|
|
20
|
+
optional int32 _360 = 15;
|
|
21
21
|
optional int32 location = 23;
|
|
22
22
|
optional int32 hdr = 25;
|
|
23
23
|
optional int32 vr180 = 26;
|
|
@@ -26,7 +26,7 @@ exports.SearchProto = protocol_buffers_1.default(`
|
|
|
26
26
|
optional int32 sortBy = 1;
|
|
27
27
|
optional Options options = 2;
|
|
28
28
|
}
|
|
29
|
-
`);
|
|
29
|
+
`).root.lookupType("SearchOptions");
|
|
30
30
|
const searchUploadDateProto = {
|
|
31
31
|
all: 0,
|
|
32
32
|
hour: 1,
|
|
@@ -4,9 +4,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.TranscriptParamsProto = void 0;
|
|
7
|
-
const
|
|
8
|
-
exports.TranscriptParamsProto =
|
|
7
|
+
const protobufjs_1 = __importDefault(require("protobufjs"));
|
|
8
|
+
exports.TranscriptParamsProto = protobufjs_1.default.parse(`
|
|
9
9
|
message TranscriptParams {
|
|
10
10
|
optional string videoId = 1;
|
|
11
11
|
}
|
|
12
|
-
`);
|
|
12
|
+
`).root.lookupType("TranscriptParams");
|
|
@@ -61,11 +61,11 @@ import { BaseChannelParser } from "./BaseChannelParser";
|
|
|
61
61
|
* await channel.live.next();
|
|
62
62
|
* console.log(channel.live.items) // first 30 live videos
|
|
63
63
|
*
|
|
64
|
-
* let
|
|
65
|
-
* console.log(
|
|
64
|
+
* let newLives = await channel.videos.next();
|
|
65
|
+
* console.log(newLives) // 30 loaded live videos
|
|
66
66
|
* console.log(channel.live.items) // first 60 live videos
|
|
67
67
|
*
|
|
68
|
-
* await channel.live.next(0); // load the rest of the videos in the channel
|
|
68
|
+
* await channel.live.next(0); // load the rest of the live videos in the channel
|
|
69
69
|
* ```
|
|
70
70
|
*/
|
|
71
71
|
var ChannelLive = /** @class */ (function (_super) {
|
|
@@ -53,19 +53,19 @@ import { VideoCompact } from "../VideoCompact";
|
|
|
53
53
|
import { I_END_POINT } from "../constants";
|
|
54
54
|
import { BaseChannelParser } from "./BaseChannelParser";
|
|
55
55
|
/**
|
|
56
|
-
* {@link Continuable} of
|
|
56
|
+
* {@link Continuable} of shorts inside a {@link BaseChannel}
|
|
57
57
|
*
|
|
58
58
|
* @example
|
|
59
59
|
* ```js
|
|
60
60
|
* const channel = await youtube.findOne(CHANNEL_NAME, {type: "channel"});
|
|
61
|
-
* await channel.
|
|
62
|
-
* console.log(channel.
|
|
61
|
+
* await channel.short.next();
|
|
62
|
+
* console.log(channel.short.items) // first 30 shorts
|
|
63
63
|
*
|
|
64
|
-
* let
|
|
65
|
-
* console.log(
|
|
66
|
-
* console.log(channel.
|
|
64
|
+
* let newShorts = await channel.short.next();
|
|
65
|
+
* console.log(newShorts) // 30 loaded shorts
|
|
66
|
+
* console.log(channel.short.items) // first 60 shorts
|
|
67
67
|
*
|
|
68
|
-
* await channel.
|
|
68
|
+
* await channel.short.next(0); // load the rest of the shorts in the channel
|
|
69
69
|
* ```
|
|
70
70
|
*/
|
|
71
71
|
var ChannelShorts = /** @class */ (function (_super) {
|
|
@@ -41,7 +41,7 @@ var BaseVideoParser = /** @class */ (function () {
|
|
|
41
41
|
// Tags and description
|
|
42
42
|
target.tags =
|
|
43
43
|
((_b = (_a = videoInfo.superTitleLink) === null || _a === void 0 ? void 0 : _a.runs) === null || _b === void 0 ? void 0 : _b.map(function (r) { return r.text.trim(); }).filter(function (t) { return t; })) || [];
|
|
44
|
-
target.description = videoInfo.shortDescription || "";
|
|
44
|
+
target.description = videoInfo.videoDetails.shortDescription || "";
|
|
45
45
|
// related videos
|
|
46
46
|
var secondaryContents = data[3].response.contents.twoColumnWatchNextResults.secondaryResults.secondaryResults
|
|
47
47
|
.results;
|
|
@@ -178,7 +178,7 @@ var Client = /** @class */ (function () {
|
|
|
178
178
|
return __generator(this, function (_a) {
|
|
179
179
|
switch (_a.label) {
|
|
180
180
|
case 0:
|
|
181
|
-
bufferParams = TranscriptParamsProto.
|
|
181
|
+
bufferParams = TranscriptParamsProto.encode({ videoId: videoId }).finish();
|
|
182
182
|
return [4 /*yield*/, this.http.post(I_END_POINT + "/get_transcript", {
|
|
183
183
|
data: { params: Buffer.from(bufferParams).toString("base64") },
|
|
184
184
|
})];
|
|
@@ -165,7 +165,7 @@ var SearchResult = /** @class */ (function (_super) {
|
|
|
165
165
|
case 0:
|
|
166
166
|
this.items = [];
|
|
167
167
|
this.estimatedResults = 0;
|
|
168
|
-
bufferParams = SearchProto.
|
|
168
|
+
bufferParams = SearchProto.encode(optionsToProto(options)).finish();
|
|
169
169
|
return [4 /*yield*/, this.client.http.post(I_END_POINT + "/search", {
|
|
170
170
|
data: {
|
|
171
171
|
query: query,
|
|
@@ -9,9 +9,9 @@ var __assign = (this && this.__assign) || function () {
|
|
|
9
9
|
};
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
|
-
import
|
|
12
|
+
import protobuf from "protobufjs";
|
|
13
13
|
// TODO move this to .proto file
|
|
14
|
-
export var SearchProto =
|
|
14
|
+
export var SearchProto = protobuf.parse("\n\tmessage SearchOptions {\n\t\tmessage Options {\n\t\t\toptional int32 uploadDate = 1;\n\t\t\toptional int32 type = 2;\n\t\t\toptional int32 duration = 3;\n\t\t\toptional int32 hd = 4;\n\t\t\toptional int32 subtitles = 5;\n\t\t\toptional int32 creativeCommons = 6;\n\t\t\toptional int32 live = 8;\n\t\t\toptional int32 _4k = 14;\n\t\t\toptional int32 _360 = 15;\n\t\t\toptional int32 location = 23;\n\t\t\toptional int32 hdr = 25;\n\t\t\toptional int32 vr180 = 26;\n\t\t}\n\n\t\toptional int32 sortBy = 1;\n\t\toptional Options options = 2;\n\t}\n").root.lookupType("SearchOptions");
|
|
15
15
|
var searchUploadDateProto = {
|
|
16
16
|
all: 0,
|
|
17
17
|
hour: 1,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
export var TranscriptParamsProto =
|
|
1
|
+
import protobuf from "protobufjs";
|
|
2
|
+
export var TranscriptParamsProto = protobuf.parse("\n\tmessage TranscriptParams {\n\t\toptional string videoId = 1;\n\t}\n").root.lookupType("TranscriptParams");
|
|
@@ -13,15 +13,15 @@ declare type ConstructorParams = ContinuableConstructorParams & {
|
|
|
13
13
|
* await channel.live.next();
|
|
14
14
|
* console.log(channel.live.items) // first 30 live videos
|
|
15
15
|
*
|
|
16
|
-
* let
|
|
17
|
-
* console.log(
|
|
16
|
+
* let newLives = await channel.videos.next();
|
|
17
|
+
* console.log(newLives) // 30 loaded live videos
|
|
18
18
|
* console.log(channel.live.items) // first 60 live videos
|
|
19
19
|
*
|
|
20
|
-
* await channel.live.next(0); // load the rest of the videos in the channel
|
|
20
|
+
* await channel.live.next(0); // load the rest of the live videos in the channel
|
|
21
21
|
* ```
|
|
22
22
|
*/
|
|
23
23
|
export declare class ChannelLive extends Continuable<VideoCompact> {
|
|
24
|
-
/** The channel this videos belongs to */
|
|
24
|
+
/** The channel this live videos belongs to */
|
|
25
25
|
channel?: BaseChannel;
|
|
26
26
|
/** @hidden */
|
|
27
27
|
constructor({ client, channel }: ConstructorParams);
|
|
@@ -5,23 +5,23 @@ declare type ConstructorParams = ContinuableConstructorParams & {
|
|
|
5
5
|
channel?: BaseChannel;
|
|
6
6
|
};
|
|
7
7
|
/**
|
|
8
|
-
* {@link Continuable} of
|
|
8
|
+
* {@link Continuable} of shorts inside a {@link BaseChannel}
|
|
9
9
|
*
|
|
10
10
|
* @example
|
|
11
11
|
* ```js
|
|
12
12
|
* const channel = await youtube.findOne(CHANNEL_NAME, {type: "channel"});
|
|
13
|
-
* await channel.
|
|
14
|
-
* console.log(channel.
|
|
13
|
+
* await channel.short.next();
|
|
14
|
+
* console.log(channel.short.items) // first 30 shorts
|
|
15
15
|
*
|
|
16
|
-
* let
|
|
17
|
-
* console.log(
|
|
18
|
-
* console.log(channel.
|
|
16
|
+
* let newShorts = await channel.short.next();
|
|
17
|
+
* console.log(newShorts) // 30 loaded shorts
|
|
18
|
+
* console.log(channel.short.items) // first 60 shorts
|
|
19
19
|
*
|
|
20
|
-
* await channel.
|
|
20
|
+
* await channel.short.next(0); // load the rest of the shorts in the channel
|
|
21
21
|
* ```
|
|
22
22
|
*/
|
|
23
23
|
export declare class ChannelShorts extends Continuable<VideoCompact> {
|
|
24
|
-
/** The channel this
|
|
24
|
+
/** The channel this shorts belongs to */
|
|
25
25
|
channel?: BaseChannel;
|
|
26
26
|
/** @hidden */
|
|
27
27
|
constructor({ client, channel }: ConstructorParams);
|
|
@@ -1,44 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import protobuf from "protobufjs";
|
|
2
2
|
import { SearchOptions } from "../SearchResult";
|
|
3
3
|
import { SearchProto as ProtoType } from "./SearchProto";
|
|
4
|
-
export declare const SearchProto:
|
|
5
|
-
SearchOptions: {
|
|
6
|
-
encode: (obj: {
|
|
7
|
-
sortBy?: number | undefined;
|
|
8
|
-
options?: {
|
|
9
|
-
uploadDate?: number | undefined;
|
|
10
|
-
type?: number | undefined;
|
|
11
|
-
duration?: number | undefined;
|
|
12
|
-
live?: number | undefined;
|
|
13
|
-
"4k"?: number | undefined;
|
|
14
|
-
hd?: number | undefined;
|
|
15
|
-
subtitles?: number | undefined;
|
|
16
|
-
creativeCommons?: number | undefined;
|
|
17
|
-
"360"?: number | undefined;
|
|
18
|
-
vr180?: number | undefined;
|
|
19
|
-
"3d"?: number | undefined;
|
|
20
|
-
hdr?: number | undefined;
|
|
21
|
-
location?: number | undefined;
|
|
22
|
-
} | undefined;
|
|
23
|
-
}) => Buffer;
|
|
24
|
-
decode: (buf: Buffer) => {
|
|
25
|
-
sortBy?: number | undefined;
|
|
26
|
-
options?: {
|
|
27
|
-
uploadDate?: number | undefined;
|
|
28
|
-
type?: number | undefined;
|
|
29
|
-
duration?: number | undefined;
|
|
30
|
-
live?: number | undefined;
|
|
31
|
-
"4k"?: number | undefined;
|
|
32
|
-
hd?: number | undefined;
|
|
33
|
-
subtitles?: number | undefined;
|
|
34
|
-
creativeCommons?: number | undefined;
|
|
35
|
-
"360"?: number | undefined;
|
|
36
|
-
vr180?: number | undefined;
|
|
37
|
-
"3d"?: number | undefined;
|
|
38
|
-
hdr?: number | undefined;
|
|
39
|
-
location?: number | undefined;
|
|
40
|
-
} | undefined;
|
|
41
|
-
};
|
|
42
|
-
};
|
|
43
|
-
};
|
|
4
|
+
export declare const SearchProto: protobuf.Type;
|
|
44
5
|
export declare const optionsToProto: (options: SearchOptions) => ProtoType["SearchOptions"];
|
|
@@ -1,16 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import protobuf from "protobufjs";
|
|
2
2
|
export declare type TranscriptParams = {
|
|
3
3
|
TranscriptParams: {
|
|
4
4
|
videoId: string;
|
|
5
5
|
};
|
|
6
6
|
};
|
|
7
|
-
export declare const TranscriptParamsProto:
|
|
8
|
-
TranscriptParams: {
|
|
9
|
-
encode: (obj: {
|
|
10
|
-
videoId: string;
|
|
11
|
-
}) => Buffer;
|
|
12
|
-
decode: (buf: Buffer) => {
|
|
13
|
-
videoId: string;
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
|
-
};
|
|
7
|
+
export declare const TranscriptParamsProto: protobuf.Type;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "youtubei",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "Simple package to get information from youtube such as videos, playlists, channels, video information & comments, related videos, up next video, and more!",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -63,6 +63,6 @@
|
|
|
63
63
|
"homepage": "https://suspiciouslookingowl.github.io/youtubei",
|
|
64
64
|
"dependencies": {
|
|
65
65
|
"node-fetch": "2.6.7",
|
|
66
|
-
"
|
|
66
|
+
"protobufjs": "7.2.4"
|
|
67
67
|
}
|
|
68
68
|
}
|