126 url =
"https://soundcloud.com"
127 resp = http_get(url, timeout=10)
130 logger.error(
"init: GET %s failed", url)
133 tree = html.fromstring(resp.content)
134 script_tags = tree.xpath(
"//script[contains(@src, '/assets/')]")
135 app_js_urls = [tag.get(
"src")
for tag
in script_tags
if tag
is not None]
139 for url
in app_js_urls[::-1]:
145 logger.error(
"init: app_js GET %s failed", url)
148 cids = cid_re.search(resp.content.decode())
149 if cids
and len(cids.groups()):
150 client_id = cids.groups()[0]
154 logger.info(
"using client_id '%s' for soundclud queries", client_id)
156 logger.warning(
"missing valid client_id for soundclud queries")
157 return client_id
or None