m3u8-parser icon indicating copy to clipboard operation
m3u8-parser copied to clipboard

parse title from extinf

Open AminTaghikhani opened this issue 5 years ago • 2 comments

Hi there,

how can I parse title from the extint? reference

I create

parser.addParser({
                    expression: /#EXTINF/,
                    customType: 'audio',
                    segment: true,
                    dataParser: function (line) {
                        const valuePart = line.split(':')
                        const values = valuePart[1].split(',')
                        const duration = parseFloat(values[0])
                        const title = values[1]
                        return {
                            duration,
                            title
                        };
                    }
                });

but only work for the last item, and the segment doesn't contain anything

AminTaghikhani avatar Jun 30 '19 08:06 AminTaghikhani

I read your codes, I found this line

regex rule is ok, but I think somewhere ignoring (this)

AminTaghikhani avatar Jun 30 '19 14:06 AminTaghikhani

Looks like we don't read it and set it out on the output here https://github.com/videojs/m3u8-parser/blob/07bd668ddb5070fff57f5e5fe86959e18f49c4e3/src/parser.js#L106-L131

gkatsev avatar Apr 08 '20 19:04 gkatsev