Skip to content

Commit

Permalink
get offset properly even when it's only 1 or 2 digit
Browse files Browse the repository at this point in the history
  • Loading branch information
fireattack committed Sep 19, 2024
1 parent ad51618 commit 8c03a85
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/core/parsers/nico.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,11 @@ export default class Parser {
const firstChunkFilename = firstChunkUrl.match(/^(.+ts)/)[1];
let offset;
if (firstChunkFilename === "0.ts") {
offset = downloader.m3u8.chunks[1].url.match(/(\d{3})\.ts/)[1];
offset = downloader.m3u8.chunks[1].url.match(/(\d{1,3})\.ts/)[1];
} else {
offset = downloader.m3u8.chunks[0].url.match(/(\d{3})\.ts/)[1];
offset = downloader.m3u8.chunks[0].url.match(/(\d{1,3})\.ts/)[1];
}
offset = offset.padStart(3, "0");
const suffix = downloader.m3u8.chunks[0].url.match(/\.ts(.+)/)[1];
const newChunkList = [];
let counter = 0;
Expand Down

0 comments on commit 8c03a85

Please sign in to comment.