on master help sign in
[fix] fix soundcloud engine, speed up searx start time
da0ce58Dalf
searx/engines/soundcloud.py+4−2
@@ -28,8 +28,10 @@ categories = ['music']
28paging = True
28paging = True
29
29
30# search-url
30# search-url
31+# missing attribute: user_id, app_version, app_locale
31−url = 'https://api.soundcloud.com/'
32+url = 'https://api-v2.soundcloud.com/'
32search_url = url + 'search?{query}'\
33search_url = url + 'search?{query}'\
34+ '&variant_ids='\
33 '&facet=model'\
35 '&facet=model'\
34 '&limit=20'\
36 '&limit=20'\
35 '&offset={offset}'\
37 '&offset={offset}'\
@@ -57,7 +59,7 @@ def get_client_id():
57 # gets app_js and searches for the clientid
59 # gets app_js and searches for the clientid
58 response = http_get(app_js_url)
60 response = http_get(app_js_url)
59 if response.ok:
61 if response.ok:
60− cids = cid_re.search(response.text)
62+ cids = cid_re.search(response.content.decode("utf-8"))
61 if cids is not None and len(cids.groups()):
63 if cids is not None and len(cids.groups()):
62 return cids.groups()[0]
64 return cids.groups()[0]
63 logger.warning("Unable to fetch guest client_id from SoundCloud, check parser!")
65 logger.warning("Unable to fetch guest client_id from SoundCloud, check parser!")