mirror of
https://github.com/LuanRT/YouTube.js.git
synced 2026-06-13 01:22:11 +00:00
feat(parser): Add AnimatedThumbnailOverlayView (#903)
* Add AnimatedThumbnailOverlayView parser. * Update nodes.ts
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -74,6 +74,9 @@ deno/
|
||||
# VSCode files
|
||||
.vscode/
|
||||
|
||||
# Webstorm files
|
||||
.idea/
|
||||
|
||||
# MacOS
|
||||
.DS_Store
|
||||
|
||||
|
||||
25
src/parser/classes/AnimatedThumbnailOverlayView.ts
Normal file
25
src/parser/classes/AnimatedThumbnailOverlayView.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { YTNode } from '../helpers.js';
|
||||
import type { RawNode } from '../types/index.js';
|
||||
|
||||
export default class AnimatedThumbnailOverlayView extends YTNode {
|
||||
static type = 'AnimatedThumbnailOverlayView';
|
||||
|
||||
thumbnail: {
|
||||
sources: {
|
||||
url: string,
|
||||
width: number,
|
||||
height: number
|
||||
}[]
|
||||
};
|
||||
|
||||
constructor(data: RawNode) {
|
||||
super();
|
||||
this.thumbnail = {
|
||||
sources: data.thumbnail.sources.map((item: any) => ({
|
||||
url: item.url,
|
||||
width: item.width,
|
||||
height: item.height
|
||||
}))
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
import type { ObservedArray } from '../helpers.js';
|
||||
import { YTNode } from '../helpers.js';
|
||||
import { Parser, type RawNode } from '../index.js';
|
||||
import AnimatedThumbnailOverlayView from './AnimatedThumbnailOverlayView.js';
|
||||
import ThumbnailHoverOverlayView from './ThumbnailHoverOverlayView.js';
|
||||
import ThumbnailOverlayBadgeView from './ThumbnailOverlayBadgeView.js';
|
||||
import Thumbnail from './misc/Thumbnail.js';
|
||||
@@ -19,6 +20,7 @@ export default class ThumbnailView extends YTNode {
|
||||
public overlays: ObservedArray<
|
||||
ThumbnailHoverOverlayToggleActionsView | ThumbnailBottomOverlayView |
|
||||
ThumbnailOverlayBadgeView | ThumbnailHoverOverlayView
|
||||
| AnimatedThumbnailOverlayView
|
||||
>;
|
||||
public background_color?: ThumbnailBackgroundColor;
|
||||
|
||||
@@ -28,7 +30,8 @@ export default class ThumbnailView extends YTNode {
|
||||
this.image = Thumbnail.fromResponse(data.image);
|
||||
this.overlays = Parser.parseArray(data.overlays, [
|
||||
ThumbnailHoverOverlayToggleActionsView, ThumbnailBottomOverlayView,
|
||||
ThumbnailOverlayBadgeView, ThumbnailHoverOverlayView
|
||||
ThumbnailOverlayBadgeView, ThumbnailHoverOverlayView,
|
||||
AnimatedThumbnailOverlayView
|
||||
]);
|
||||
|
||||
if ('backgroundColor' in data) {
|
||||
|
||||
@@ -21,6 +21,7 @@ export { default as ActiveAccountHeader } from './classes/ActiveAccountHeader.js
|
||||
export { default as AddToPlaylist } from './classes/AddToPlaylist.js';
|
||||
export { default as Alert } from './classes/Alert.js';
|
||||
export { default as AlertWithButton } from './classes/AlertWithButton.js';
|
||||
export { default as AnimatedThumbnailOverlayView } from './classes/AnimatedThumbnailOverlayView.js';
|
||||
export { default as AttributionView } from './classes/AttributionView.js';
|
||||
export { default as AudioOnlyPlayability } from './classes/AudioOnlyPlayability.js';
|
||||
export { default as AutomixPreviewVideo } from './classes/AutomixPreviewVideo.js';
|
||||
|
||||
Reference in New Issue
Block a user