ionic-youtube-search
Advanced tools
Comparing version 2.0.0 to 2.1.0
@@ -23,4 +23,5 @@ export declare const Name: (name: string) => string; | ||
title: string; | ||
views: any; | ||
}; | ||
views: any; | ||
}[]>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.search = exports.Name = void 0; | ||
var search_1 = require("./lib/search"); | ||
var Name = function (name) { return "Hello " + name; }; | ||
exports.Name = Name; | ||
exports.Name = function (name) { return "Hello " + name; }; | ||
function search(searchQuery) { | ||
@@ -8,0 +6,0 @@ return search_1.searchVideo(searchQuery); |
@@ -23,2 +23,3 @@ export declare class ParserService { | ||
title: string; | ||
views: any; | ||
}; | ||
@@ -25,0 +26,0 @@ views: any; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ParserService = void 0; | ||
var ParserService = /** @class */ (function () { | ||
@@ -8,2 +7,3 @@ function ParserService() { | ||
ParserService.prototype.parseVideo = function (data) { | ||
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y; | ||
if (!data) | ||
@@ -13,4 +13,4 @@ return undefined; | ||
var title = ''; | ||
if (data.videoRenderer) { | ||
title = data.videoRenderer.title.runs[0].text; | ||
if (data.compactVideoRenderer) { | ||
title = data.compactVideoRenderer.title.runs[0].text; | ||
title = title.replace("\\\\", "\\"); | ||
@@ -25,25 +25,66 @@ try { | ||
id: { | ||
videoId: data.videoRenderer.videoId | ||
videoId: data.compactVideoRenderer.videoId | ||
}, | ||
url: "https://www.youtube.com/watch?v=" + data.videoRenderer.videoId, | ||
url: "https://www.youtube.com/watch?v=" + data.compactVideoRenderer.videoId, | ||
title: title, | ||
description: data.videoRenderer.descriptionSnippet && data.videoRenderer.descriptionSnippet.runs[0] ? data.videoRenderer.descriptionSnippet.runs[0].text : "", | ||
duration_raw: data.videoRenderer.lengthText ? data.videoRenderer.lengthText.simpleText : null, | ||
description: data.compactVideoRenderer.descriptionSnippet && data.compactVideoRenderer.descriptionSnippet.runs[0] ? data.compactVideoRenderer.descriptionSnippet.runs[0].text : "", | ||
duration_raw: data.compactVideoRenderer.lengthText ? data.compactVideoRenderer.lengthText.simpleText : null, | ||
snippet: { | ||
url: "https://www.youtube.com/watch?v=" + data.videoRenderer.videoId, | ||
duration: data.videoRenderer.lengthText ? data.videoRenderer.lengthText.simpleText : null, | ||
publishedAt: data.videoRenderer.publishedTimeText ? data.videoRenderer.publishedTimeText.simpleText : null, | ||
url: "https://www.youtube.com/watch?v=" + data.compactVideoRenderer.videoId, | ||
duration: data.compactVideoRenderer.lengthText ? data.compactVideoRenderer.lengthText.simpleText : null, | ||
publishedAt: data.compactVideoRenderer.publishedTimeText ? data.compactVideoRenderer.publishedTimeText.simpleText : null, | ||
thumbnails: { | ||
id: data.videoRenderer.videoId, | ||
url: data.videoRenderer.thumbnail.thumbnails[data.videoRenderer.thumbnail.thumbnails.length - 1].url, | ||
default: data.videoRenderer.thumbnail.thumbnails[data.videoRenderer.thumbnail.thumbnails.length - 1], | ||
high: data.videoRenderer.thumbnail.thumbnails[data.videoRenderer.thumbnail.thumbnails.length - 1], | ||
height: data.videoRenderer.thumbnail.thumbnails[data.videoRenderer.thumbnail.thumbnails.length - 1].height, | ||
width: data.videoRenderer.thumbnail.thumbnails[data.videoRenderer.thumbnail.thumbnails.length - 1].width | ||
id: data.compactVideoRenderer.videoId, | ||
url: data.compactVideoRenderer.thumbnail.thumbnails[data.compactVideoRenderer.thumbnail.thumbnails.length - 1].url, | ||
default: data.compactVideoRenderer.thumbnail.thumbnails[data.compactVideoRenderer.thumbnail.thumbnails.length - 1], | ||
high: data.compactVideoRenderer.thumbnail.thumbnails[data.compactVideoRenderer.thumbnail.thumbnails.length - 1], | ||
height: data.compactVideoRenderer.thumbnail.thumbnails[data.compactVideoRenderer.thumbnail.thumbnails.length - 1].height, | ||
width: data.compactVideoRenderer.thumbnail.thumbnails[data.compactVideoRenderer.thumbnail.thumbnails.length - 1].width | ||
}, | ||
title: title | ||
title: title, | ||
views: data.compactVideoRenderer.viewCountText && data.compactVideoRenderer.viewCountText.simpleText ? data.compactVideoRenderer.viewCountText.simpleText.replace(/[^0-9]/g, "") : 0 | ||
}, | ||
views: data.videoRenderer.viewCountText && data.videoRenderer.viewCountText.simpleText ? data.videoRenderer.viewCountText.simpleText.replace(/[^0-9]/g, "") : 0 | ||
views: data.compactVideoRenderer.viewCountText && data.compactVideoRenderer.viewCountText.simpleText ? data.compactVideoRenderer.viewCountText.simpleText.replace(/[^0-9]/g, "") : 0 | ||
}; | ||
} | ||
else if (data.videoWithContextRenderer) { | ||
if (((_a = data.videoWithContextRenderer.headline) === null || _a === void 0 ? void 0 : _a.runs) && ((_b = data.videoWithContextRenderer.headline) === null || _b === void 0 ? void 0 : _b.runs.length) > 0) { | ||
title = (_c = data.videoWithContextRenderer.headline) === null || _c === void 0 ? void 0 : _c.runs[0].text; | ||
} | ||
else { | ||
title = (_f = (_e = (_d = data.videoWithContextRenderer.headline) === null || _d === void 0 ? void 0 : _d.accessibility) === null || _e === void 0 ? void 0 : _e.accessibilityData) === null || _f === void 0 ? void 0 : _f.label; | ||
} | ||
title = title.replace("\\\\", "\\"); | ||
try { | ||
title = decodeURIComponent(title); | ||
} | ||
catch (e) { | ||
// @ts-ignore | ||
} | ||
return { | ||
id: { | ||
videoId: data.videoWithContextRenderer.videoId | ||
}, | ||
url: "https://www.youtube.com/watch?v=" + data.videoWithContextRenderer.videoId, | ||
title: title, | ||
description: '', | ||
duration_raw: (_j = (_h = (_g = data.videoWithContextRenderer.lengthText) === null || _g === void 0 ? void 0 : _g.accessibility) === null || _h === void 0 ? void 0 : _h.accessibilityData) === null || _j === void 0 ? void 0 : _j.text, | ||
snippet: { | ||
url: "https://www.youtube.com/watch?v=" + data.videoWithContextRenderer.videoId, | ||
duration: (_m = (_l = (_k = data.videoWithContextRenderer.lengthText) === null || _k === void 0 ? void 0 : _k.accessibility) === null || _l === void 0 ? void 0 : _l.accessibilityData) === null || _m === void 0 ? void 0 : _m.text, | ||
publishedAt: ((_p = (_o = data.videoWithContextRenderer.publishedTimeText) === null || _o === void 0 ? void 0 : _o.runs) === null || _p === void 0 ? void 0 : _p.length) > 0 ? (_q = data.videoWithContextRenderer.publishedTimeText) === null || _q === void 0 ? void 0 : _q.runs[0].text : null, | ||
thumbnails: { | ||
id: data.videoWithContextRenderer.videoId, | ||
url: data.videoWithContextRenderer.thumbnail.thumbnails[data.videoWithContextRenderer.thumbnail.thumbnails.length - 1].url, | ||
default: data.videoWithContextRenderer.thumbnail.thumbnails[data.videoWithContextRenderer.thumbnail.thumbnails.length - 1], | ||
high: data.videoWithContextRenderer.thumbnail.thumbnails[data.videoWithContextRenderer.thumbnail.thumbnails.length - 1], | ||
height: data.videoWithContextRenderer.thumbnail.thumbnails[data.videoWithContextRenderer.thumbnail.thumbnails.length - 1].height, | ||
width: data.videoWithContextRenderer.thumbnail.thumbnails[data.videoWithContextRenderer.thumbnail.thumbnails.length - 1].width | ||
}, | ||
title: title, | ||
views: (_u = (_t = (_s = (_r = data.videoWithContextRenderer.shortViewCountText) === null || _r === void 0 ? void 0 : _r.accessibility) === null || _s === void 0 ? void 0 : _s.accessibilityData) === null || _t === void 0 ? void 0 : _t.label) === null || _u === void 0 ? void 0 : _u.replace(/[^0-9]/g, "") | ||
}, | ||
views: (_y = (_x = (_w = (_v = data.videoWithContextRenderer.shortViewCountText) === null || _v === void 0 ? void 0 : _v.accessibility) === null || _w === void 0 ? void 0 : _w.accessibilityData) === null || _x === void 0 ? void 0 : _x.label) === null || _y === void 0 ? void 0 : _y.replace(/[^0-9]/g, "") | ||
}; | ||
} | ||
return undefined; | ||
@@ -50,0 +91,0 @@ } |
@@ -22,4 +22,5 @@ export declare function searchVideo(searchString: string, token?: string): Promise<{ | ||
title: string; | ||
views: any; | ||
}; | ||
views: any; | ||
}[]>; |
@@ -39,3 +39,2 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.searchVideo = void 0; | ||
var ngx_1 = require("@ionic-native/http/ngx"); | ||
@@ -42,0 +41,0 @@ var parser_service_1 = require("./parser.service"); |
{ | ||
"name": "ionic-youtube-search", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"description": "Search videos on YouTube without API key in ionic apps", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -39,43 +39,40 @@ # [ionic-youtube-search: Node.js](https://github.com/appit-online/ionic-youtube-search) | ||
[ | ||
{ | ||
"id":{ | ||
"videoId":"y5kIrbG2gRc" | ||
}, | ||
"snippet":{ | ||
"url":"https://www.youtube.com/watch?v=y5kIrbG2gRc", | ||
"publishedAt":"3 months ago", | ||
"thumbnails":{ | ||
"default":{ | ||
"url":"https://i.ytimg.com/vi/y5kIrbG2gRc/default.jpg", | ||
"width":120, | ||
"height":90 | ||
{ | ||
"id": | ||
{ | ||
"videoId": "y5kIrbG2gRc" | ||
}, | ||
"url": "https://www.youtube.com/watch?v=y5kIrbG2gRc", | ||
"title": "How to Download Free Music On Your iPhone (OFFLINE) 2020", | ||
"description": "", | ||
"duration_raw": "2:01", | ||
"snippet": | ||
{ | ||
"url": "https://www.youtube.com/watch?v=y5kIrbG2gRc", | ||
"duration": "2:01", | ||
"publishedAt": "3 years ago", | ||
"thumbnails": | ||
{ | ||
"id": "y5kIrbG2gRc", | ||
"url": "https://i.ytimg.com/vi/y5kIrbG2gRc/hq720.jpg?sqp=-oaymwEXCNAFEJQDSFryq4qpAwkIARUAAIhCGAE=&rs=AOn4CLDuzgRSHVaWMTmiU4TAzv0Opz2CmQ", | ||
"default": | ||
{ | ||
"url": "https://i.ytimg.com/vi/y5kIrbG2gRc/hq720.jpg?sqp=-oaymwEXCNAFEJQDSFryq4qpAwkIARUAAIhCGAE=&rs=AOn4CLDuzgRSHVaWMTmiU4TAzv0Opz2CmQ", | ||
"width": 720, | ||
"height": 404 | ||
}, | ||
"high": | ||
{ | ||
"url": "https://i.ytimg.com/vi/y5kIrbG2gRc/hq720.jpg?sqp=-oaymwEXCNAFEJQDSFryq4qpAwkIARUAAIhCGAE=&rs=AOn4CLDuzgRSHVaWMTmiU4TAzv0Opz2CmQ", | ||
"width": 720, | ||
"height": 404 | ||
}, | ||
"height": 404, | ||
"width": 720 | ||
}, | ||
"high":{ | ||
"url":"https://i.ytimg.com/vi/y5kIrbG2gRc/hq720.jpg?sqp=-oaymwEhCK4FEIIDSFryq4qpAxMIARUAAAAAGAElAADIQj0AgKJD&rs=AOn4CLC9c-4JI285aXTlg99bne9V224hVw", | ||
"width":686, | ||
"height":386 | ||
} | ||
}, | ||
"duration":{ | ||
"runs":[ | ||
{ | ||
"text":"2:01" | ||
} | ||
], | ||
"accessibility":{ | ||
"accessibilityData":{ | ||
"label":"2 minutes, 1 second" | ||
} | ||
} | ||
}, | ||
"title":"How to Download Free Music On Your iPhone (OFFLINE) 2020", | ||
"views":{ | ||
"runs":[ | ||
{ | ||
"text":"51 views" | ||
} | ||
] | ||
} | ||
} | ||
} | ||
"title": "How to Download Free Music On Your iPhone (OFFLINE) 2020" | ||
}, | ||
"views": "199" | ||
}, | ||
... | ||
] | ||
@@ -82,0 +79,0 @@ |
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
31917
297
104