update jisho.py according to suggestions

This commit is contained in:
Austin Huang 2022-04-01 09:18:19 -04:00
parent 934ae4e086
commit a399248f56
No known key found for this signature in database
GPG Key ID: 84C23AA04587A91F
1 changed files with 84 additions and 81 deletions

View File

@ -14,9 +14,11 @@ about = {
"use_official_api": True,
"require_api_key": False,
"results": 'JSON',
"language": 'ja',
}
categories = ['dictionaries']
engine_type = 'online_dictionary'
paging = False
URL = 'https://jisho.org'
@ -35,12 +37,13 @@ def response(resp):
results = []
infoboxed = False
search_results = json.loads(resp.text)
search_results = resp.json()
pages = search_results.get('data', [])
for page in pages:
# Entries that are purely from Wikipedia are excluded.
if page['senses'][0]['parts_of_speech'][0] != 'Wikipedia definition':
if page['senses'][0]['parts_of_speech'] != [] and page['senses'][0]['parts_of_speech'][0] == 'Wikipedia definition':
pass
# Process alternative forms
japanese = page['japanese']
alt_forms = []