From 1af85ad42ee999ab393f92052e4aec963b6f4d7a Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 28 Jan 2017 09:25:31 +0530 Subject: [PATCH] Update NYTimes --- recipes/nytimes.recipe | 4 ++++ recipes/nytimes_sub.recipe | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/recipes/nytimes.recipe b/recipes/nytimes.recipe index 1514d2482c..ed2fa30de0 100644 --- a/recipes/nytimes.recipe +++ b/recipes/nytimes.recipe @@ -240,6 +240,7 @@ class NYTimes(BasicNewsRecipe): dict(attrs={'class': lambda x: x and 'skip-to-text-link' in x.split()}), dict(attrs={'class': lambda x: x and 'sharetools' in x.split()}), dict(attrs={'class': lambda x: x and 'ad' in x.split()}), + dict(attrs={'class': lambda x: x and 'visually-hidden' in x.split()}), dict(name='div', attrs={'class': re.compile('toolsList')}), # bits dict(name='div', attrs={ 'class': re.compile('postNavigation')}), # bits @@ -1061,6 +1062,9 @@ class NYTimes(BasicNewsRecipe): aside.extract() soup = self.strip_anchors(soup, True) + for t in soup.findAll('time', attrs={'class':'dateline'}): + t.name = 'div' + if soup.find('div', attrs={'id': 'blogcontent'}) is None: if first_fetch: aside = soup.find('div', 'aside') diff --git a/recipes/nytimes_sub.recipe b/recipes/nytimes_sub.recipe index 5ac7056a52..997132a000 100644 --- a/recipes/nytimes_sub.recipe +++ b/recipes/nytimes_sub.recipe @@ -240,6 +240,7 @@ class NYTimes(BasicNewsRecipe): dict(attrs={'class': lambda x: x and 'skip-to-text-link' in x.split()}), dict(attrs={'class': lambda x: x and 'sharetools' in x.split()}), dict(attrs={'class': lambda x: x and 'ad' in x.split()}), + dict(attrs={'class': lambda x: x and 'visually-hidden' in x.split()}), dict(name='div', attrs={'class': re.compile('toolsList')}), # bits dict(name='div', attrs={ 'class': re.compile('postNavigation')}), # bits @@ -1069,6 +1070,9 @@ class NYTimes(BasicNewsRecipe): aside.extract() soup = self.strip_anchors(soup, True) + for t in soup.findAll('time', attrs={'class':'dateline'}): + t.name = 'div' + if soup.find('div', attrs={'id': 'blogcontent'}) is None: if first_fetch: aside = soup.find('div', 'aside')