Fix Cambridge service for Chinese version

This commit is contained in:
xr2439 2019-09-15 15:46:17 +08:00
parent 3fb46c5fc2
commit 61b2b7f9a1

View File

@ -31,7 +31,8 @@ class Cambridge(WebService):
} }
# english # english
element = soup.find('div', class_='page') page = 'page' if type(self).__name__ == 'CambridgeEE' else 'di-body'
element = soup.find('div', class_=page)
if element: if element:
# 页 # 页
elements = element.find_all('div', class_='entry-body__el') elements = element.find_all('div', class_='entry-body__el')
@ -101,7 +102,7 @@ class Cambridge(WebService):
def_info = (span_df.get_text().replace('', '') if span_df else '') def_info = (span_df.get_text().replace('', '') if span_df else '')
d = block.find('div', class_='def') d = block.find('div', class_='def')
tran = block.find('span', class_='trans') tran = block.find('span', class_='trans')
examps = block.find_all('span', class_='eg deg') examps = block.find_all('div', class_='examp dexamp')
l.append( l.append(
u'<li>{0}{1}{2}{3}{4} {5}{6}</li>'.format( u'<li>{0}{1}{2}{3}{4} {5}{6}</li>'.format(
'<span class="epp-xref">{0}</span>'.format(pos_gram) if pos_gram != '' else '', '<span class="epp-xref">{0}</span>'.format(pos_gram) if pos_gram != '' else '',