def extra(self, page): """ Return a dictionary of extra information. """ dic_extra = {} try: if page.find(TAG_EXTRA[0]) > -1: extra_html = Utils.text_between(page, TAG_EXTRA[0], TAG_EXTRA[1], True) extra_rows = Utils.split_html_tag(Utils.remove_spaces(extra_html), TAG_EXTRA_SEP) for row in extra_rows: _row = Utils.remove_tags(row) key, value = _row.split(":") dic_extra[Utils.remove_spaces(key)] = Utils.remove_spaces(value) except: pass return dic_extra
def scrape_meaning(self, page): """ Return meaning and etymology. """ html = Utils.text_between(page, *TAG_MEANING, force_html=True) etymology = Utils.text_between(html, *TAG_ETYMOLOGY, force_html=True) etymology = Utils.remove_spaces(Utils.remove_tags(etymology)) meanings = Utils.split_html_tag(html, 'br') meanings = [ Utils.remove_spaces(Utils.remove_tags(x)) for x in meanings ] meaning = [x for x in meanings if x != etymology] return meaning, etymology
def scrape_extra(self, page): """ Return a dictionary of extra information. """ dict_extra = {} try: if page.find(TAG_EXTRA[0]) > -1: html = Utils.text_between(page, *TAG_EXTRA, force_html=True) extra_rows = Utils.split_html_tag(Utils.remove_spaces(html), TAG_EXTRA_SEP) for row in extra_rows: _row = Utils.remove_tags(row) key, value = map(Utils.remove_spaces, _row.split(":")) dict_extra[key] = value except: pass return dict_extra