In [3]:
import re
import base64
import zlib
In [4]:
from urllib.parse import quote, unquote
import base64

def js_encode_uri_component(data):
    return quote(data, safe='~()*!.\'')


def js_decode_uri_component(data):
    return unquote(data)


def js_string_to_byte(data):
    return bytes(data, 'iso-8859-1')


def js_bytes_to_string(data):
    return data.decode('iso-8859-1')


def js_btoa(data):
    return base64.b64encode(data)


def js_atob(data):
    return base64.b64decode(data)
In [5]:
def pako_inflate_raw(data):
    decompress = zlib.decompressobj(-15)
    decompressed_data = decompress.decompress(data)
    decompressed_data += decompress.flush()
    return decompressed_data
In [6]:
xml = open("mgraph.xml").read()
In [7]:
m = re.search("<diagram.*>([^<]+)</diagram>", xml)
if m:
    b64 = m.groups()[0]
a = base64.b64decode(b64)
In [8]:
b = pako_inflate_raw(a)
In [9]:
c = js_decode_uri_component(b.decode())
In [10]:
mapping = []
m = re.findall("<([^>]+mname[^>]+)>", c)
if m:
    for n in m:
        m = re.search("mname=\"(\d+)\".*id=\"(.*)\"", n)
        if m:
            mapping.append(m.groups())
mapping = dict(mapping)
In [11]:
mapping
Out[11]:
{'0': '1EbLMt5FDJ4zT_VL_kNa-238',
 '43': '1EbLMt5FDJ4zT_VL_kNa-239',
 '46': '1EbLMt5FDJ4zT_VL_kNa-240',
 '1': '1EbLMt5FDJ4zT_VL_kNa-241',
 '7': '1EbLMt5FDJ4zT_VL_kNa-242',
 '2': '1EbLMt5FDJ4zT_VL_kNa-243',
 '32': '1EbLMt5FDJ4zT_VL_kNa-244',
 '3': '1EbLMt5FDJ4zT_VL_kNa-245',
 '44': '1EbLMt5FDJ4zT_VL_kNa-246',
 '27': '1EbLMt5FDJ4zT_VL_kNa-247',
 '40': '1EbLMt5FDJ4zT_VL_kNa-248',
 '8': '1EbLMt5FDJ4zT_VL_kNa-249',
 '41': '1EbLMt5FDJ4zT_VL_kNa-250',
 '19': '1EbLMt5FDJ4zT_VL_kNa-251',
 '10': '1EbLMt5FDJ4zT_VL_kNa-252',
 '29': '1EbLMt5FDJ4zT_VL_kNa-253',
 '30': '1EbLMt5FDJ4zT_VL_kNa-254',
 '18': '1EbLMt5FDJ4zT_VL_kNa-255',
 '36': '1EbLMt5FDJ4zT_VL_kNa-256',
 '13': '1EbLMt5FDJ4zT_VL_kNa-257',
 '5': '1EbLMt5FDJ4zT_VL_kNa-258',
 '14': '1EbLMt5FDJ4zT_VL_kNa-259',
 '9': '1EbLMt5FDJ4zT_VL_kNa-260',
 '17': '1EbLMt5FDJ4zT_VL_kNa-261',
 '34': '1EbLMt5FDJ4zT_VL_kNa-262',
 '4': '1EbLMt5FDJ4zT_VL_kNa-263',
 '15': '1EbLMt5FDJ4zT_VL_kNa-264',
 '21': '1EbLMt5FDJ4zT_VL_kNa-265',
 '23': '1EbLMt5FDJ4zT_VL_kNa-266',
 '47': '1EbLMt5FDJ4zT_VL_kNa-267',
 '37': '1EbLMt5FDJ4zT_VL_kNa-268',
 '39': '1EbLMt5FDJ4zT_VL_kNa-269',
 '35': '1EbLMt5FDJ4zT_VL_kNa-270',
 '42': '1EbLMt5FDJ4zT_VL_kNa-271',
 '48': '1EbLMt5FDJ4zT_VL_kNa-272',
 '31': '1EbLMt5FDJ4zT_VL_kNa-273',
 '16': '1EbLMt5FDJ4zT_VL_kNa-274',
 '6': '1EbLMt5FDJ4zT_VL_kNa-275',
 '25': '1EbLMt5FDJ4zT_VL_kNa-276',
 '28': '1EbLMt5FDJ4zT_VL_kNa-277',
 '24': '1EbLMt5FDJ4zT_VL_kNa-278',
 '20': '1EbLMt5FDJ4zT_VL_kNa-279',
 '22': '1EbLMt5FDJ4zT_VL_kNa-280',
 '45': '1EbLMt5FDJ4zT_VL_kNa-281',
 '11': '1EbLMt5FDJ4zT_VL_kNa-282',
 '38': '1EbLMt5FDJ4zT_VL_kNa-283',
 '12': '1EbLMt5FDJ4zT_VL_kNa-284',
 '26': '1EbLMt5FDJ4zT_VL_kNa-285',
 '49': '1EbLMt5FDJ4zT_VL_kNa-286',
 '33': '1EbLMt5FDJ4zT_VL_kNa-287'}
In [ ]: