diff --git a/recipes/nytimes.recipe b/recipes/nytimes.recipe index 802b09baf7..4cb76e4871 100644 --- a/recipes/nytimes.recipe +++ b/recipes/nytimes.recipe @@ -82,10 +82,12 @@ class NewYorkTimes(BasicNewsRecipe): remove_tags = [ dict(attrs={'aria-label':'tools'.split()}), + dict(attrs={'aria-hidden':'true'}), dict(attrs={'data-videoid':True}), dict(name='button meta link'.split()), dict(id=lambda x: x and x.startswith('story-ad-')), dict(name='head'), + dict(role='toolbar'), dict(name='a', href=lambda x: x and '#story-continues-' in x), dict(name='a', href=lambda x: x and '#whats-next' in x), dict(id=lambda x: x and 'sharetools-' in x), @@ -106,7 +108,7 @@ class NewYorkTimes(BasicNewsRecipe): ] else: keep_only_tags = [ - dict(id='story') + dict(id='story'), ] body = Tag(soup, 'body') for spec in keep_only_tags: @@ -114,12 +116,6 @@ class NewYorkTimes(BasicNewsRecipe): body.insert(len(body.contents), tag) soup.find('body').replaceWith(body) - # Remove the header bar with New York Times as an SVG in it - for svg in soup.findAll('svg'): - h = svg.findParent('header') - if h is not None: - h.extract() - # Add a space to the dateline t = soup.find(**classes('dateline')) if t is not None: diff --git a/recipes/nytimes_sub.recipe b/recipes/nytimes_sub.recipe index 2e377f6ed6..a3e3844ced 100644 --- a/recipes/nytimes_sub.recipe +++ b/recipes/nytimes_sub.recipe @@ -82,10 +82,12 @@ class NewYorkTimes(BasicNewsRecipe): remove_tags = [ dict(attrs={'aria-label':'tools'.split()}), + dict(attrs={'aria-hidden':'true'}), dict(attrs={'data-videoid':True}), dict(name='button meta link'.split()), dict(id=lambda x: x and x.startswith('story-ad-')), dict(name='head'), + dict(role='toolbar'), dict(name='a', href=lambda x: x and '#story-continues-' in x), dict(name='a', href=lambda x: x and '#whats-next' in x), dict(id=lambda x: x and 'sharetools-' in x), @@ -106,7 +108,7 @@ class NewYorkTimes(BasicNewsRecipe): ] else: keep_only_tags = [ - dict(id='story') + dict(id='story'), ] body = Tag(soup, 'body') for spec in keep_only_tags: @@ -114,12 +116,6 @@ class NewYorkTimes(BasicNewsRecipe): body.insert(len(body.contents), tag) soup.find('body').replaceWith(body) - # Remove the header bar with New York Times as an SVG in it - for svg in soup.findAll('svg'): - h = svg.findParent('header') - if h is not None: - h.extract() - # Add a space to the dateline t = soup.find(**classes('dateline')) if t is not None: