diff options
author | ManeraKai <manerakai@protonmail.com> | 2022-04-03 21:49:40 +0300 |
---|---|---|
committer | ManeraKai <manerakai@protonmail.com> | 2022-04-03 21:49:40 +0300 |
commit | 8a9bdc3d1d435e9377cec0bd430d591caf654cd1 (patch) | |
tree | 3f82530f2c350bac25a76958bb54aebf90be3554 /src/instances/get_instances.py | |
parent | Tweaked a thing #164 #161 (diff) | |
download | libredirect-8a9bdc3d1d435e9377cec0bd430d591caf654cd1.zip |
Seperated searX and SearXNG in the list #120
Diffstat (limited to 'src/instances/get_instances.py')
-rw-r--r-- | src/instances/get_instances.py | 35 |
1 files changed, 24 insertions, 11 deletions
diff --git a/src/instances/get_instances.py b/src/instances/get_instances.py index 13eb80a8..1d2409a7 100644 --- a/src/instances/get_instances.py +++ b/src/instances/get_instances.py @@ -141,24 +141,37 @@ mightyList['lingva'] = lingvaList print('fetched LinvgaTranslate') -# SearX +# SearX, SearXNG r = requests.get('https://searx.space/data/instances.json') rJson = json.loads(r.text) searxList = {} -searxList['normal'] = [] searxList['tor'] = [] searxList['i2p'] = [] -for item in rJson['instances'].keys(): - item = item[:-1] - if item.endswith('.onion'): - searxList['tor'].append(item) - elif item.endswith('.i2p'): - searxList['i2p'].append(item) +searxList['normal'] = [] +searxngList = {} +searxngList['tor'] = [] +searxngList['i2p'] = [] +searxngList['normal'] = [] +for item in rJson['instances']: + if item[:-1].endswith('.onion'): + if (rJson['instances'][item].get('generator') == 'searxng'): + searxngList['tor'].append(item[:-1]) + else: + searxList['tor'].append(item[:-1]) + elif item[:-1].endswith('.i2p'): + if (rJson['instances'][item].get('generator') == 'searxng'): + searxngList['i2p'].append(item[:-1]) + else: + searxList['i2p'].append(item[:-1]) else: - searxList['normal'].append(item) -mightyList['searx'] = searxList -print('fetched SearX') + if (rJson['instances'][item].get('generator') == 'searxng'): + searxngList['normal'].append(item[:-1]) + else: + searxList['normal'].append(item[:-1]) +mightyList['searx'] = searxList +mightyList['searxng'] = searxngList +print('fetched SearX, SearXNG') # Whoogle r = requests.get( |