mirror of
https://github.com/LuanRT/YouTube.js.git
synced 2026-06-18 20:12:12 +00:00
* feat: add core comments section classes * chore: update type declarations * chore: fix linter warnings * style: fix linter * chore: update tests * chore(tests): fix typo * chore(tests): fix typo x2 * fix(tests): `getReplies()` method is only present in `CommentThread` and not `Comment` * chore(tests): fix comment id path * chore(tests): remove outdated code * chore(tests): fix results path * chore: enforce code style * chore: update type declarations * docs: add examples and documentation * chore(docs): fix paths * chore(docs): fix more paths * chore(docs): fix `Comments.js` path * chore(docs): fix typo * chore(docs): mention example file * chore(examples): fix imports * chore(examples): fix typo
44 lines
1.0 KiB
JavaScript
44 lines
1.0 KiB
JavaScript
'use strict';
|
|
|
|
class PlayerStoryboardSpec {
|
|
type = 'PlayerStoryboardSpec';
|
|
|
|
constructor(data) {
|
|
const parts = data.spec.split('|');
|
|
const url = new URL(parts.shift());
|
|
|
|
this.boards = parts.map((part, i) => {
|
|
let [
|
|
thumbnail_width,
|
|
thumbnail_height,
|
|
thumbnail_count,
|
|
columns,
|
|
rows,
|
|
interval,
|
|
name,
|
|
sigh
|
|
] = part.split('#');
|
|
|
|
url.searchParams.set('sigh', sigh);
|
|
|
|
thumbnail_count = parseInt(thumbnail_count, 10);
|
|
columns = parseInt(columns, 10);
|
|
rows = parseInt(rows, 10);
|
|
|
|
const storyboard_count = Math.ceil(thumbnail_count / (columns * rows));
|
|
|
|
return {
|
|
template_url: url.toString().replace('$L', i).replace('$N', name),
|
|
thumbnail_width: parseInt(thumbnail_width, 10),
|
|
thumbnail_height: parseInt(thumbnail_height, 10),
|
|
thumbnail_count,
|
|
interval: parseInt(interval, 10),
|
|
columns,
|
|
rows,
|
|
storyboard_count
|
|
};
|
|
});
|
|
}
|
|
}
|
|
|
|
module.exports = PlayerStoryboardSpec; |