added new field to Yahoo Dict.
This commit is contained in:
parent
360aa066ec
commit
cdf182a9bc
@ -21,11 +21,11 @@ class Yahoo_Dict(WebService):
|
|||||||
'phon': '',
|
'phon': '',
|
||||||
'def': '',
|
'def': '',
|
||||||
'audio_url': '',
|
'audio_url': '',
|
||||||
|
'detail': '',
|
||||||
}
|
}
|
||||||
|
|
||||||
# 基本
|
# 基本
|
||||||
element = soup.find(
|
element = soup.find('div', class_='dd cardDesign dictionaryWordCard sys_dict_word_card')
|
||||||
'div', class_='dd cardDesign dictionaryWordCard sys_dict_word_card')
|
|
||||||
if element:
|
if element:
|
||||||
# 音标
|
# 音标
|
||||||
tag = element.find('div', class_='compList ml-25 d-ib')
|
tag = element.find('div', class_='compList ml-25 d-ib')
|
||||||
@ -42,6 +42,13 @@ class Yahoo_Dict(WebService):
|
|||||||
result['def'] = u'<div class="dd cardDesign">' + \
|
result['def'] = u'<div class="dd cardDesign">' + \
|
||||||
str(tag.find('ul')).decode('utf-8') + u'</div>'
|
str(tag.find('ul')).decode('utf-8') + u'</div>'
|
||||||
|
|
||||||
|
# 释义
|
||||||
|
tag = soup.find('div', class_='grp grp-tab-content-explanation tabsContent tab-content-explanation tabActived')
|
||||||
|
if tag:
|
||||||
|
result['detail'] = u'<div class="dd cardDesign">' + \
|
||||||
|
str(tag.find('ul')).decode('utf-8') + u'</div>'
|
||||||
|
|
||||||
|
|
||||||
return self.cache_this(result)
|
return self.cache_this(result)
|
||||||
|
|
||||||
def _get_field(self, key, default=u''):
|
def _get_field(self, key, default=u''):
|
||||||
@ -84,3 +91,10 @@ class Yahoo_Dict(WebService):
|
|||||||
if val is None or val == '':
|
if val is None or val == '':
|
||||||
return ''
|
return ''
|
||||||
return self._css(val)
|
return self._css(val)
|
||||||
|
|
||||||
|
@export(u'详细释义')
|
||||||
|
def fld_detail(self):
|
||||||
|
val = self._get_field('detail')
|
||||||
|
if val is None or val == '':
|
||||||
|
return ''
|
||||||
|
return self._css(val)
|
||||||
|
|||||||
@ -63,6 +63,10 @@ ul, menu, dir {
|
|||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.dd .fz-16, .fz-16 {
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
.dd .fl-l, .fl-l {
|
.dd .fl-l, .fl-l {
|
||||||
float: left;
|
float: left;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user