Fix key moments importing as chapters

This commit is contained in:
Ajay 2022-10-10 23:34:34 -04:00
parent 5d62b11a6d
commit 49a166a6b2

View file

@ -70,7 +70,8 @@ export function getExistingChapters(currentVideoID: VideoID, duration: number):
const chaptersBox = document.querySelector("ytd-macro-markers-list-renderer"); const chaptersBox = document.querySelector("ytd-macro-markers-list-renderer");
const chapters: SponsorTime[] = []; const chapters: SponsorTime[] = [];
if (chaptersBox) { // .ytp-timed-markers-container indicates that key-moments are present, which should not be divided
if (chaptersBox && !(document.querySelector(".ytp-timed-markers-container")?.childElementCount > 0)) {
let lastSegment: SponsorTime = null; let lastSegment: SponsorTime = null;
const links = chaptersBox.querySelectorAll("ytd-macro-markers-list-item-renderer > a"); const links = chaptersBox.querySelectorAll("ytd-macro-markers-list-item-renderer > a");
for (const link of links) { for (const link of links) {