In source Out script type text javascript somevar 5535 bbb 15345 7534

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
In [5]: source
Out[5]: '<script type="text/javascript">somevar=5535; bbb=15345; x=7534; g=53; y=543; n=543; </script>'
In [8]: content = re.match(r'<script.*>(.*)</script>', source).group(1)
In [15]: dict(x.rstrip(';').split('=') for x in content.split())
Out[15]:
{'bbb': '15345',
'g': '53',
'n': '543',
'somevar': '5535',
'x': '7534',
'y': '543'}