forked from Ponysearch/Ponysearch
update jisho.py according to suggestions
This commit is contained in:
parent
934ae4e086
commit
a399248f56
1 changed files with 84 additions and 81 deletions
|
@ -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…
Reference in a new issue