Add simplified and traditional translation fields to cambridge dictionary.

This commit is contained in:
Javan Zhu 2019-01-20 09:46:42 +08:00
parent bb487e1259
commit 4047a5a169

View File

@ -60,11 +60,13 @@ class Cambridge(WebService):
for tag in tags:
i = tag.find('span', class_='def-info')
d = tag.find('b', class_='def')
trans = tag.find('span', class_='trans')
es = tag.find_all('div', class_='examp emphasized')
l.append(
u'<li>{0}{1}{2}</li>'.format(
u'<li>{0}{1}{2}{3}</li>'.format(
u'<span class="epp-xref">{0}</span>'.format(i.get_text()) if i else u'',
u'<b class="def">{0}</b>'.format(d.get_text()) if d else u'',
u'<span class="trans">{0}</span>'.format(trans.get_text()) if trans else u'',
u''.join(
u'<div class="examp">{0}</div>'.format(e.get_text()) if e else u''
for e in es