@exode-team/kinescope.api 2.0.38 → 2.0.41
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/video-service.d.ts +0 -6
- package/dist/video-service.js +2 -23
- package/package.json +1 -1
package/dist/video-service.d.ts
CHANGED
|
@@ -7,12 +7,6 @@
|
|
|
7
7
|
import { BaseService } from './base-service';
|
|
8
8
|
import { VideoUploadHeadersByFile, VideoUploadHeadersByUrl, VideoUploadResponse } from './types';
|
|
9
9
|
export declare class VideoService extends BaseService {
|
|
10
|
-
/**
|
|
11
|
-
* Prepare video title
|
|
12
|
-
* @param {string} title
|
|
13
|
-
* @returns {string}
|
|
14
|
-
*/
|
|
15
|
-
prepareTitle(title: string): string;
|
|
16
10
|
/**
|
|
17
11
|
* Upload video by file
|
|
18
12
|
* @param {File | Buffer} data
|
package/dist/video-service.js
CHANGED
|
@@ -26,27 +26,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
26
26
|
exports.VideoService = void 0;
|
|
27
27
|
const base_service_1 = require("./base-service");
|
|
28
28
|
class VideoService extends base_service_1.BaseService {
|
|
29
|
-
/**
|
|
30
|
-
* Prepare video title
|
|
31
|
-
* @param {string} title
|
|
32
|
-
* @returns {string}
|
|
33
|
-
*/
|
|
34
|
-
prepareTitle(title) {
|
|
35
|
-
if (!title) {
|
|
36
|
-
return title;
|
|
37
|
-
}
|
|
38
|
-
const cyrillicToLatinMap = {
|
|
39
|
-
'А': 'A', 'Б': 'B', 'В': 'V', 'Г': 'G', 'Д': 'D', 'Е': 'E', 'Ё': 'E', 'Ж': 'Zh', 'З': 'Z',
|
|
40
|
-
'И': 'I', 'Й': 'Y', 'К': 'K', 'Л': 'L', 'М': 'M', 'Н': 'N', 'О': 'O', 'П': 'P', 'Р': 'R',
|
|
41
|
-
'С': 'S', 'Т': 'T', 'У': 'U', 'Ф': 'F', 'Х': 'Kh', 'Ц': 'Ts', 'Ч': 'Ch', 'Ш': 'Sh', 'Щ': 'Shch',
|
|
42
|
-
'Ы': 'Y', 'Э': 'E', 'Ю': 'Yu', 'Я': 'Ya',
|
|
43
|
-
'а': 'a', 'б': 'b', 'в': 'v', 'г': 'g', 'д': 'd', 'е': 'e', 'ё': 'e', 'ж': 'zh', 'з': 'z',
|
|
44
|
-
'и': 'i', 'й': 'y', 'к': 'k', 'л': 'l', 'м': 'm', 'н': 'n', 'о': 'o', 'п': 'p', 'р': 'r',
|
|
45
|
-
'с': 's', 'т': 't', 'у': 'u', 'ф': 'f', 'х': 'kh', 'ц': 'ts', 'ч': 'ch', 'ш': 'sh', 'щ': 'shch',
|
|
46
|
-
'ы': 'y', 'э': 'e', 'ю': 'yu', 'я': 'ya',
|
|
47
|
-
};
|
|
48
|
-
return title === null || title === void 0 ? void 0 : title.split('').map((char) => cyrillicToLatinMap[char] || char).join('').replace(/[А-Яа-яЁё]/g, '');
|
|
49
|
-
}
|
|
50
29
|
/**
|
|
51
30
|
* Upload video by file
|
|
52
31
|
* @param {File | Buffer} data
|
|
@@ -56,7 +35,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
56
35
|
uploadVideoByFile(data, headers) {
|
|
57
36
|
return __awaiter(this, void 0, void 0, function* () {
|
|
58
37
|
try {
|
|
59
|
-
return yield this.requestApi('https://uploader.kinescope.io/v2/video', data, 'post', Object.assign(Object.assign({}, headers), { 'X-Video-Title':
|
|
38
|
+
return yield this.requestApi('https://uploader.kinescope.io/v2/video', data, 'post', Object.assign(Object.assign({}, headers), { 'X-Video-Title': encodeURI(headers['X-Video-Title']) }));
|
|
60
39
|
}
|
|
61
40
|
catch (error) {
|
|
62
41
|
console.error(`${error}`);
|
|
@@ -72,7 +51,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
72
51
|
uploadVideoByUrl(headers) {
|
|
73
52
|
return __awaiter(this, void 0, void 0, function* () {
|
|
74
53
|
try {
|
|
75
|
-
return yield this.requestApi('https://uploader.kinescope.io/v2/video', {}, 'post', headers);
|
|
54
|
+
return yield this.requestApi('https://uploader.kinescope.io/v2/video', {}, 'post', Object.assign(Object.assign({}, headers), { 'X-Video-Title': encodeURI(headers['X-Video-Title']) }));
|
|
76
55
|
}
|
|
77
56
|
catch (error) {
|
|
78
57
|
console.error(`${error}`);
|