← Back
import sys
html_path, json_path = sys.argv[1], sys.argv[2]
src = open(html_path).read()
data = open(json_path).read().strip()
needle = '/*' + '__DATA__' + '*/'
src = src.replace(needle, data)
open(html_path, 'w').write(src)
print('injected:', needle not in src)