def _parse_src_js_var(self, variable):

        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(m.group(1).strip())
Parse JavaScript variables in the source page
dataset/ETHPy150Open shichao-an/115wangpan/u115/api.py/API._parse_src_js_var