M3U
audio/x-mpegurl
Magic Bytes
Offset: 0
23 45 58 54 4D 33 55 0D 0A
M3U is a plain text multimedia playlist file format originally developed by Nullsoft for the Winamp media player. It serves as a simple index that points software to the precise locations of audio or video files on a local drive or internet URL for sequential playback. While the format is inherently safe plain text containing no actual media data, it remains the de facto standard for organizing streaming content across most platforms.
Validation Code
How to validate .m3u files in Python
Python
def is_m3u(file_path: str) -> bool:
"""Check if file is a valid M3U by magic bytes."""
signature = bytes([0x23, 0x45, 0x58, 0x54, 0x4D, 0x33, 0x55, 0x0D, 0x0A])
with open(file_path, "rb") as f:
return f.read(9) == signature
How to validate .m3u files in Node.js
Node.js
function isM3U(buffer: Buffer): boolean {
const signature = Buffer.from([0x23, 0x45, 0x58, 0x54, 0x4D, 0x33, 0x55, 0x0D, 0x0A]);
return buffer.subarray(0, 9).equals(signature);
}
Go
func IsM3U(data []byte) bool {
signature := []byte{0x23, 0x45, 0x58, 0x54, 0x4D, 0x33, 0x55, 0x0D, 0x0A}
if len(data) < 9 {
return false
}
return bytes.Equal(data[:9], signature)
}
API Endpoint
GET
/api/v1/m3u
curl https://filesignature.org/api/v1/m3u