Skip to content

Pasting YouTube chapters does not import correctly #21

Description

@TheJayMann

Attempting to paste YouTube format chapters results in a new project containing 0 chapters. When reviewing and debugging the javascript, I assume this is also the case when attempting to paste any text based chapter list. When the pasted format is detected as text, but is not detected as a url, it attempts to autodetect the text (which is working for YouTube chapters), then attempts to convert it to ChaptersJson format (which fails).

const data = new ChaptersJson(detected)

This attempts to create a new ChaptersJson object passing in the detected format. ChaptersJson does not define its own constructor, using the constructor from Base instead, which assumes the value passed in is a duration value. Because the detected format is not (by itself) a duration value, nothing gets imported into the ChaptersJson object.
I believe that line of code should instead be changed to either const data = ChaptersJson.create(detected.duration, detected), or const data = new ChaptersJson(detected.duration).from(detected). In my testing, after the errant line was executed, I was able to get the paste to work properly by running in the console data.from(detected).

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions