youtubei 0.0.1-rc.28 → 0.0.1-rc.30
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/classes/Client.d.ts
CHANGED
|
@@ -7,9 +7,9 @@ export declare namespace Client {
|
|
|
7
7
|
type SearchType = "video" | "channel" | "playlist" | "all";
|
|
8
8
|
type SearchOptions = {
|
|
9
9
|
/** Search type, can be `"video"`, `"channel"`, `"playlist"`, or `"all"` */
|
|
10
|
-
type
|
|
10
|
+
type?: SearchType;
|
|
11
11
|
/** Raw search params to be passed on the request, ignores `type` value if this is provided */
|
|
12
|
-
params
|
|
12
|
+
params?: string;
|
|
13
13
|
};
|
|
14
14
|
type ClientOptions = {
|
|
15
15
|
cookie: string;
|
|
@@ -33,7 +33,7 @@ export default class Client {
|
|
|
33
33
|
* @param searchOptions Search options
|
|
34
34
|
*
|
|
35
35
|
*/
|
|
36
|
-
search<T extends Client.SearchOptions>(query: string, searchOptions?:
|
|
36
|
+
search<T extends Client.SearchOptions>(query: string, searchOptions?: T): Promise<SearchResult<T["type"]>>;
|
|
37
37
|
/**
|
|
38
38
|
* Search for videos / playlists / channels and returns the first result
|
|
39
39
|
*
|
|
@@ -65,7 +65,7 @@ class LiveVideo extends _1.BaseVideo {
|
|
|
65
65
|
const response = yield this.client.http.post(constants_1.LIVE_CHAT_END_POINT, {
|
|
66
66
|
data: { continuation: this.chatContinuation },
|
|
67
67
|
});
|
|
68
|
-
if (!response.continuationContents)
|
|
68
|
+
if (!response.data.continuationContents)
|
|
69
69
|
return;
|
|
70
70
|
this.parseChat(response.data);
|
|
71
71
|
const timedContinuation = response.data.continuationContents.liveChatContinuation.continuations[0]
|
|
@@ -77,7 +77,8 @@ class LiveVideo extends _1.BaseVideo {
|
|
|
77
77
|
}
|
|
78
78
|
/** Parse chat data from Youtube and add to chatQueue */
|
|
79
79
|
parseChat(data) {
|
|
80
|
-
|
|
80
|
+
var _a;
|
|
81
|
+
const chats = ((_a = data.continuationContents.liveChatContinuation.actions) === null || _a === void 0 ? void 0 : _a.flatMap((a) => { var _a; return ((_a = a.addChatItemAction) === null || _a === void 0 ? void 0 : _a.item.liveChatTextMessageRenderer) || []; })) || [];
|
|
81
82
|
for (const rawChatData of chats) {
|
|
82
83
|
const chat = new _1.Chat({ client: this.client }).load(rawChatData);
|
|
83
84
|
if (this._chatQueue.find((c) => c.id === chat.id))
|
|
@@ -68,7 +68,7 @@ let SearchResult = SearchResult_1 = class SearchResult extends Array {
|
|
|
68
68
|
const response = yield this.client.http.post(`${constants_1.I_END_POINT}/search`, {
|
|
69
69
|
data: {
|
|
70
70
|
query,
|
|
71
|
-
params: options.params || SearchResult_1.getSearchTypeParam(options.type),
|
|
71
|
+
params: options.params || SearchResult_1.getSearchTypeParam(options.type || "all"),
|
|
72
72
|
},
|
|
73
73
|
});
|
|
74
74
|
this.estimatedResults = +response.data.estimatedResults;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "youtubei",
|
|
3
|
-
"version": "0.0.1-rc.
|
|
3
|
+
"version": "0.0.1-rc.30",
|
|
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/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|