vbf-parser is a Python library for parsing VBF files.
Use the package manager pip to install.
pip install vbf-parser
Simple parsing with converting to json:
import json
from vbf_parser import extract_header_body, jsonify_vbf_header
with open("file.vbf", "rb") as file:
header_body = extract_header_body(file)
vbf = json.loads(jsonify_vbf_header(header_body))
Proper lexing and manual parsing:
from vbf_parser import extract_header_body, lex_vbf_header, parse_vbf_tokens
with open("file.vbf", "rb") as file:
header_body = extract_header_body(file)
vbf = parse_vbf_tokens(lex_vbf_header(header_body))