[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.
commit38c210d7468d709a77e1a45bacfba87fd0975bef
authorAlexandre Flament <alex@al-f.net>
dateSun 21 Mar 2021, 09:29 (6 years ago)
parent12fa524
searx/engines/soundcloud.py+1−1
@@ -55,7 +55,7 @@ def get_client_id():
5555 app_js_urls = [script_tag.get('src') for script_tag in script_tags if script_tag is not None]
5656
5757 # extracts valid app_js urls from soundcloud.com content
58− for app_js_url in app_js_urls:
58+ for app_js_url in app_js_urls[::-1]:
5959 # gets app_js and searches for the clientid
6060 response = http_get(app_js_url)
6161 if response.ok: