diff --git a/recipes/nytimes.recipe b/recipes/nytimes.recipe index 4cb76e4871..94cc0ba293 100644 --- a/recipes/nytimes.recipe +++ b/recipes/nytimes.recipe @@ -120,6 +120,11 @@ class NewYorkTimes(BasicNewsRecipe): t = soup.find(**classes('dateline')) if t is not None: t.insert(0, ' ') + + # Remove empty li tags + for li in soup.findAll('li', attrs={'class': lambda x: x and x.startswith('css-')}): + if not li.contents and not li.string: + li.extract() return soup def read_nyt_metadata(self): diff --git a/recipes/nytimes_sub.recipe b/recipes/nytimes_sub.recipe index a3e3844ced..7d9e4e3703 100644 --- a/recipes/nytimes_sub.recipe +++ b/recipes/nytimes_sub.recipe @@ -120,6 +120,11 @@ class NewYorkTimes(BasicNewsRecipe): t = soup.find(**classes('dateline')) if t is not None: t.insert(0, ' ') + + # Remove empty li tags + for li in soup.findAll('li', attrs={'class': lambda x: x and x.startswith('css-')}): + if not li.contents and not li.string: + li.extract() return soup def read_nyt_metadata(self):