Raiper34 / m3u-parser-generator

Library to parse and generate m3u or m3u8 IPTV playlist files
https://m3u-parser-generator.netlify.app
MIT License
24 stars 11 forks source link

M3uParser.parse() -> M3uParser.getAttributes() - Attribute value can't be null! #10

Closed Bastian-R-dotcom closed 7 months ago

Bastian-R-dotcom commented 8 months ago

Hey,

I debugged my react-app and i found that the error was caused by the library and in precision by the M3uParser.parse() static function calling M3uParser.getAttributes() static function.

On a particular m3u link even if the rest of the links don't cause the error the process is stopped and we can't get just one of all the channels.

I found that the process has been stopped when all the attributes was missing in a particular m3u link.

My suggestion is during the parsing this error might be a warning about which m3u link can't be parsed and delete it but don't stop the all the process and just return a error.

Waiting for your answer. :)

Bastian-R-dotcom commented 8 months ago
image
Bastian-R-dotcom commented 8 months ago

Update : i did an update on my api thinking she was giving in the response an m3u link in incorrect format.

image

Weirdly now when i analyze the response data in front before calling the parser all is fine but the m3u parser function still logging "Attribute value can't be null !".

Maybe the problem is more critical and not cause of my data from my api.

Raiper34 commented 7 months ago

Hi, thanks for opening the issue, can you provide more details? What is the line of your playlist, you have a problem with? Can you send an example? Also if you want to ignore errors during parsing, you can use ignoreErrors parameter of the parse method. See https://m3u-parser-generator.netlify.app/classes/m3uparser#parse

hugomcm commented 7 months ago

Hello there,

I got the same error an found out that if the attribute starts with a space, for example -> tvg-name=" Super" it will fail. Hope that helps to figure out the bug.

Raiper34 commented 7 months ago

Thanks, guys, I have found the problem, I needed to turn off exception raising now, so basically parser will parse valid attributes and skip invalid ones. Commit https://github.com/Raiper34/m3u-parser-generator/commit/935497010e4714d97e1860498df3afc2cf201e87 Will be released during the weekend.

Raiper34 commented 7 months ago

Released under v1.6.0