youtube.ts
Advanced tools
Comparing version 0.2.1 to 0.2.2
@@ -24,2 +24,6 @@ /// <reference types="node" /> | ||
downloadThumbnail: (videoResolvable: string, folder?: string, noDL?: boolean) => Promise<string>; | ||
/** | ||
* Gets a video's title from the url. | ||
*/ | ||
getTitle: (videoResolvable: string) => Promise<string>; | ||
} |
@@ -509,2 +509,20 @@ "use strict"; | ||
}); }; | ||
/** | ||
* Gets a video's title from the url. | ||
*/ | ||
this.getTitle = function (videoResolvable) { return __awaiter(_this, void 0, void 0, function () { | ||
var id, url, info; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, this.resolveID(videoResolvable, "video")]; | ||
case 1: | ||
id = _a.sent(); | ||
url = "https://www.youtube.com/watch?v=" + id; | ||
return [4 /*yield*/, ytdl_core_1["default"].getInfo(url)]; | ||
case 2: | ||
info = _a.sent(); | ||
return [2 /*return*/, info.videoDetails.title]; | ||
} | ||
}); | ||
}); }; | ||
} | ||
@@ -511,0 +529,0 @@ return Util; |
@@ -268,2 +268,12 @@ import axios from "axios" | ||
} | ||
/** | ||
* Gets a video's title from the url. | ||
*/ | ||
public getTitle = async (videoResolvable: string) => { | ||
const id = await this.resolveID(videoResolvable, "video") | ||
const url = `https://www.youtube.com/watch?v=${id}` | ||
const info = await ytdl.getInfo(url) | ||
return info.videoDetails.title | ||
} | ||
} |
{ | ||
"name": "youtube.ts", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"description": "Wrapper for the YouTube API with typings.", | ||
@@ -5,0 +5,0 @@ "main": "dist/youtube.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
160148
3384