update jisho.py according to suggestions

pull/1030/head
Austin Huang 2 years ago
parent 934ae4e086
commit a399248f56
No known key found for this signature in database
GPG Key ID: 84C23AA04587A91F

@ -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 = []

Loading…
Cancel
Save