refine code, extract the m3u8 parser and randome time builder