ytdl-org/youtube-dl · error · ExtractorError
Not an SWF file; header is %r
Error message
Not an SWF file; header is %r
What it means
Error "Not an SWF file; header is %r" thrown in ytdl-org/youtube-dl.
Source
Thrown at youtube_dl/swfinterp.py:18
from __future__ import unicode_literals
import collections
import io
import zlib
from .compat import (
compat_str,
compat_struct_unpack,
)
from .utils import (
ExtractorError,
)
def _extract_tags(file_contents):
if file_contents[1:3] != b'WS':
raise ExtractorError(
'Not an SWF file; header is %r' % file_contents[:3])
if file_contents[:1] == b'C':
content = zlib.decompress(file_contents[8:])
else:
raise NotImplementedError(
'Unsupported compression format %r' %
file_contents[:1])
# Determine number of bits in framesize rectangle
framesize_nbits = compat_struct_unpack('!B', content[:1])[0] >> 3
framesize_len = (5 + 4 * framesize_nbits + 7) // 8
pos = framesize_len + 2 + 2
while pos < len(content):
header16 = compat_struct_unpack('<H', content[pos:pos + 2])[0]
pos += 2
tag_code = header16 >> 6
tag_len = header16 & 0x3fView on GitHub (pinned to 956b8c5855)
Solutions
- Provide a valid SWF file; the header indicates the file is not SWF.
When it happens
Trigger: Thrown at youtube_dl/swfinterp.py:18 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of ytdl-org/youtube-dl@956b8c5855 (2026-08-14).
Data as JSON: /api/errors/d339830c17e2d421.
Report an issue: GitHub.