[fix] fix soundcloud engine, speed up searx start time

This commit is contained in:
Dalf 2019-07-18 21:34:07 +02:00
parent 7e201cbf65
commit da0ce5880f
1 changed files with 4 additions and 2 deletions

View File

@ -28,8 +28,10 @@ categories = ['music']
paging = True paging = True
# search-url # search-url
url = 'https://api.soundcloud.com/' # missing attribute: user_id, app_version, app_locale
url = 'https://api-v2.soundcloud.com/'
search_url = url + 'search?{query}'\ search_url = url + 'search?{query}'\
'&variant_ids='\
'&facet=model'\ '&facet=model'\
'&limit=20'\ '&limit=20'\
'&offset={offset}'\ '&offset={offset}'\
@ -57,7 +59,7 @@ def get_client_id():
# 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:
cids = cid_re.search(response.text) cids = cid_re.search(response.content.decode("utf-8"))
if cids is not None and len(cids.groups()): if cids is not None and len(cids.groups()):
return cids.groups()[0] return cids.groups()[0]
logger.warning("Unable to fetch guest client_id from SoundCloud, check parser!") logger.warning("Unable to fetch guest client_id from SoundCloud, check parser!")