

def _parse_src_js_var(self, variable):
    'Parse JavaScript variables in the source page'
    src_url = 'http://115.com'
    r = self.http.get(src_url)
    soup = BeautifulSoup(r.content)
    scripts = [script.text for script in soup.find_all('script')]
    text = '\n'.join(scripts)
    pattern = ('%s\\s*=\\s*(.*);' % variable.upper())
    m = re.search(pattern, text)
    if (not m):
        msg = ('Cannot parse source JavaScript for %s.' % variable)
        raise APIError(msg)
    return json.loads(src_url.group(1).strip())

dataset/ETHPy150Open shichao-an/115wangpan/u115/api.py API._parse_src_js_var/VarMisuse@115/176 `m`->`src_url`