[mod] soundcloud: faster initialization

The get_cliend_id() function:
* fetches https://soundcloud.com
* then fetches each referenced javascript URL to get the client id.

This commit fetches the javascript URLs in the reverse order: the client id is in the last javascript URL.
This commit is contained in:
Alexandre Flament 2021-03-21 09:29:53 +01:00 committed by GitHub
parent 12fa524cf7
commit 38c210d746
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -55,7 +55,7 @@ def get_client_id():
app_js_urls = [script_tag.get('src') for script_tag in script_tags if script_tag is not None] app_js_urls = [script_tag.get('src') for script_tag in script_tags if script_tag is not None]
# extracts valid app_js urls from soundcloud.com content # extracts valid app_js urls from soundcloud.com content
for app_js_url in app_js_urls: for app_js_url in app_js_urls[::-1]:
# gets app_js and searches for the clientid # gets app_js and searches for the clientid
response = http_get(app_js_url) response = http_get(app_js_url)
if response.ok: if response.ok: