133 url =
"https://soundcloud.com"
134 resp = http_get(url, timeout=10)
137 logger.error(
"init: GET %s failed", url)
140 tree = html.fromstring(resp.content)
141 script_tags = tree.xpath(
"//script[contains(@src, '/assets/')]")
142 app_js_urls = [tag.get(
"src")
for tag
in script_tags
if tag
is not None]
146 for url
in app_js_urls[::-1]:
152 logger.error(
"init: app_js GET %s failed", url)
155 cids = cid_re.search(resp.content.decode())
156 if cids
and len(cids.groups()):
157 client_id = cids.groups()[0]
161 logger.info(
"using client_id '%s' for soundclud queries", client_id)
163 logger.warning(
"missing valid client_id for soundclud queries")
164 return client_id
or None