suyashb95/WiktionaryParser

Seems a bug when cope with the word phone number

littlefive5 opened this issue · 1 comments

definitions = parser.fetch("phone number")
`AttributeError                            Traceback (most recent call last)
<ipython-input-35-f004712ed494> in <module>
----> 1 definitions = parser.fetch("phone number")

C:\ProgramData\Anaconda3\lib\site-packages\wiktionaryparser.py in fetch(self, word, language)
    258         self.current_word = word
    259         self.clean_html()
--> 260         return self.get_word_data(language.lower())

C:\ProgramData\Anaconda3\lib\site-packages\wiktionaryparser.py in get_word_data(self, language)
    115             'definitions': self.parse_definitions(word_contents),
    116             'etymologies': self.parse_etymologies(word_contents),
--> 117             'related': self.parse_related_words(word_contents),
    118             'pronunciations': self.parse_pronunciations(word_contents),
    119         }

C:\ProgramData\Anaconda3\lib\site-packages\wiktionaryparser.py in parse_related_words(self, word_contents)
    219             span_tag = self.soup.find_all('span', {'id': related_id})[0]
    220             parent_tag = span_tag.parent
--> 221             while not parent_tag.find_all('li'):
    222                 parent_tag = parent_tag.find_next_sibling()
    223             for list_tag in parent_tag.find_all('li'):

AttributeError: 'NoneType' object has no attribute 'find_all'`

@littlefive5 Thanks for reporting this! Feel free to submit a PR for this if you have a fix, I'm not actively working on this project currently but, will be able to pick it up later