youtubei 1.3.4 → 1.3.6
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.
|
@@ -74,12 +74,15 @@ class Client {
|
|
|
74
74
|
}
|
|
75
75
|
/** Get video information by video id or URL */
|
|
76
76
|
getVideo(videoId) {
|
|
77
|
+
var _a;
|
|
77
78
|
return __awaiter(this, void 0, void 0, function* () {
|
|
78
79
|
const response = yield this.http.get(`${constants_1.WATCH_END_POINT}`, {
|
|
79
80
|
params: { v: videoId, pbj: "1" },
|
|
80
81
|
});
|
|
81
|
-
if (!response.data[3].response.contents)
|
|
82
|
+
if (!((_a = response.data[3]) === null || _a === void 0 ? void 0 : _a.response.contents) ||
|
|
83
|
+
response.data[2].playerResponse.playabilityStatus.status === "ERROR") {
|
|
82
84
|
return undefined;
|
|
85
|
+
}
|
|
83
86
|
return (!response.data[2].playerResponse.playabilityStatus.liveStreamability
|
|
84
87
|
? new Video_1.Video({ client: this }).load(response.data)
|
|
85
88
|
: new LiveVideo_1.LiveVideo({ client: this }).load(response.data));
|
|
@@ -134,17 +134,20 @@ var Client = /** @class */ (function () {
|
|
|
134
134
|
};
|
|
135
135
|
/** Get video information by video id or URL */
|
|
136
136
|
Client.prototype.getVideo = function (videoId) {
|
|
137
|
+
var _a;
|
|
137
138
|
return __awaiter(this, void 0, void 0, function () {
|
|
138
139
|
var response;
|
|
139
|
-
return __generator(this, function (
|
|
140
|
-
switch (
|
|
140
|
+
return __generator(this, function (_b) {
|
|
141
|
+
switch (_b.label) {
|
|
141
142
|
case 0: return [4 /*yield*/, this.http.get("" + WATCH_END_POINT, {
|
|
142
143
|
params: { v: videoId, pbj: "1" },
|
|
143
144
|
})];
|
|
144
145
|
case 1:
|
|
145
|
-
response =
|
|
146
|
-
if (!response.data[3].response.contents)
|
|
146
|
+
response = _b.sent();
|
|
147
|
+
if (!((_a = response.data[3]) === null || _a === void 0 ? void 0 : _a.response.contents) ||
|
|
148
|
+
response.data[2].playerResponse.playabilityStatus.status === "ERROR") {
|
|
147
149
|
return [2 /*return*/, undefined];
|
|
150
|
+
}
|
|
148
151
|
return [2 /*return*/, (!response.data[2].playerResponse.playabilityStatus.liveStreamability
|
|
149
152
|
? new Video({ client: this }).load(response.data)
|
|
150
153
|
: new LiveVideo({ client: this }).load(response.data))];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "youtubei",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.6",
|
|
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",
|