Skip to content

Instantly share code, notes, and snippets.

@mheistermann
Last active December 18, 2015 17:05
Show Gist options
  • Save mheistermann/c76eea9c2ce33b64d31c to your computer and use it in GitHub Desktop.
Save mheistermann/c76eea9c2ce33b64d31c to your computer and use it in GitHub Desktop.
from strings import stringlist
import re
import json
re_stringaccess = re.compile(r"_\$_447d\[([0-9]+)\]")
def main():
def repl(matchobj):
numstr = matchobj.groups()[0]
idx = json.loads(numstr)
return "'{}'".format(stringlist[idx])
with open("unstringed.js","w") as outfile:
for line in open("jsnice.js"):
fixed = re_stringaccess.sub(repl, line)
outfile.write(fixed)
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment