mirror of
https://github.com/LuanRT/YouTube.js.git
synced 2026-06-27 16:48:55 +00:00
20 lines
575 B
JavaScript
20 lines
575 B
JavaScript
'use strict';
|
|
|
|
class GridPlaylistItem {
|
|
static parse(data) {
|
|
return data.map((item) => this.parseItem(item)).filter((item) => item);
|
|
}
|
|
|
|
static parseItem(item) {
|
|
return {
|
|
id: item?.gridPlaylistRenderer.playlistId,
|
|
title: item?.gridPlaylistRenderer.title?.runs?.map((run) => run.text).join(''),
|
|
metadata: {
|
|
thumbnail: item?.gridPlaylistRenderer.thumbnail?.thumbnails?.slice(-1)[0] || {},
|
|
video_count: item?.gridPlaylistRenderer.videoCountShortText?.simpleText || 'N/A',
|
|
}
|
|
};
|
|
}
|
|
}
|
|
|
|
module.exports = GridPlaylistItem; |