Update The Atlantic

Fixes #1852755 [atlantic.recipe broken](https://bugs.launchpad.net/calibre/+bug/1852755)
This commit is contained in:
Kovid Goyal 2019-11-17 09:36:24 +05:30
parent f41348a5e1
commit 941e31aa46
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 44 additions and 40 deletions

View File

@ -26,7 +26,7 @@ class TheAtlantic(BasicNewsRecipe):
else:
title = 'The Atlantic'
description = 'Current affairs and politics focussed on the US'
INDEX = 'http://www.theatlantic.com/magazine/'
INDEX = 'https://www.theatlantic.com/magazine/'
__author__ = 'Kovid Goyal'
language = 'en'
@ -97,24 +97,24 @@ class TheAtlantic(BasicNewsRecipe):
use_embedded_content = False
feeds = [
('The Atlantic', 'http://www.theatlantic.com/feed/all/'),
('Best of The Atlantic', 'http://www.theatlantic.com/feed/best-of/'),
('Politics | The Atlantic', 'http://www.theatlantic.com/feed/channel/politics/'),
('Business | The Atlantic', 'http://www.theatlantic.com/feed/channel/business/'),
('Culture | The Atlantic', 'http://www.theatlantic.com/feed/channel/entertainment/'),
('Global | The Atlantic', 'http://www.theatlantic.com/feed/channel/international/'),
('Technology | The Atlantic', 'http://www.theatlantic.com/feed/channel/technology/'),
('U.S. | The Atlantic', 'http://www.theatlantic.com/feed/channel/national/'),
('Health | The Atlantic', 'http://www.theatlantic.com/feed/channel/health/'),
('Video | The Atlantic', 'http://www.theatlantic.com/feed/channel/video/'),
('Sexes | The Atlantic', 'http://www.theatlantic.com/feed/channel/sexes/'),
('Education | The Atlantic', 'http://www.theatlantic.com/feed/channel/education/'),
('Science | The Atlantic', 'http://www.theatlantic.com/feed/channel/science/'),
('News | The Atlantic', 'http://www.theatlantic.com/feed/channel/news/'),
('Press Releases | The Atlantic', 'http://www.theatlantic.com/feed/channel/press-releases/'),
('Newsletters | The Atlantic', 'http://www.theatlantic.com/feed/channel/newsletters/'),
('The Atlantic Photo', 'http://feeds.feedburner.com/theatlantic/infocus'),
('Notes | The Atlantic', 'http://feeds.feedburner.com/TheAtlanticNotes'),
('The Atlantic', 'https://www.theatlantic.com/feed/all/'),
('Best of The Atlantic', 'https://www.theatlantic.com/feed/best-of/'),
('Politics | The Atlantic', 'https://www.theatlantic.com/feed/channel/politics/'),
('Business | The Atlantic', 'https://www.theatlantic.com/feed/channel/business/'),
('Culture | The Atlantic', 'https://www.theatlantic.com/feed/channel/entertainment/'),
('Global | The Atlantic', 'https://www.theatlantic.com/feed/channel/international/'),
('Technology | The Atlantic', 'https://www.theatlantic.com/feed/channel/technology/'),
('U.S. | The Atlantic', 'https://www.theatlantic.com/feed/channel/national/'),
('Health | The Atlantic', 'https://www.theatlantic.com/feed/channel/health/'),
('Video | The Atlantic', 'https://www.theatlantic.com/feed/channel/video/'),
('Sexes | The Atlantic', 'https://www.theatlantic.com/feed/channel/sexes/'),
('Education | The Atlantic', 'https://www.theatlantic.com/feed/channel/education/'),
('Science | The Atlantic', 'https://www.theatlantic.com/feed/channel/science/'),
('News | The Atlantic', 'https://www.theatlantic.com/feed/channel/news/'),
('Press Releases | The Atlantic', 'https://www.theatlantic.com/feed/channel/press-releases/'),
('Newsletters | The Atlantic', 'https://www.theatlantic.com/feed/channel/newsletters/'),
('The Atlantic Photo', 'https://feeds.feedburner.com/theatlantic/infocus'),
('Notes | The Atlantic', 'https://feeds.feedburner.com/TheAtlanticNotes'),
]
else:
def parse_index(self):
@ -140,9 +140,11 @@ class TheAtlantic(BasicNewsRecipe):
elif 'hed' in cls:
title = self.tag_to_string(h2)
a = h2.findParent('a', href=True)
if a is None:
continue
url = a['href']
if url.startswith('/'):
url = 'http://www.theatlantic.com' + url
url = 'https://www.theatlantic.com' + url
li = a.findParent(
'li',
attrs={'class': lambda x: x and 'article' in x.split()}

View File

@ -26,7 +26,7 @@ class TheAtlantic(BasicNewsRecipe):
else:
title = 'The Atlantic'
description = 'Current affairs and politics focussed on the US'
INDEX = 'http://www.theatlantic.com/magazine/'
INDEX = 'https://www.theatlantic.com/magazine/'
__author__ = 'Kovid Goyal'
language = 'en'
@ -97,24 +97,24 @@ class TheAtlantic(BasicNewsRecipe):
use_embedded_content = False
feeds = [
('The Atlantic', 'http://www.theatlantic.com/feed/all/'),
('Best of The Atlantic', 'http://www.theatlantic.com/feed/best-of/'),
('Politics | The Atlantic', 'http://www.theatlantic.com/feed/channel/politics/'),
('Business | The Atlantic', 'http://www.theatlantic.com/feed/channel/business/'),
('Culture | The Atlantic', 'http://www.theatlantic.com/feed/channel/entertainment/'),
('Global | The Atlantic', 'http://www.theatlantic.com/feed/channel/international/'),
('Technology | The Atlantic', 'http://www.theatlantic.com/feed/channel/technology/'),
('U.S. | The Atlantic', 'http://www.theatlantic.com/feed/channel/national/'),
('Health | The Atlantic', 'http://www.theatlantic.com/feed/channel/health/'),
('Video | The Atlantic', 'http://www.theatlantic.com/feed/channel/video/'),
('Sexes | The Atlantic', 'http://www.theatlantic.com/feed/channel/sexes/'),
('Education | The Atlantic', 'http://www.theatlantic.com/feed/channel/education/'),
('Science | The Atlantic', 'http://www.theatlantic.com/feed/channel/science/'),
('News | The Atlantic', 'http://www.theatlantic.com/feed/channel/news/'),
('Press Releases | The Atlantic', 'http://www.theatlantic.com/feed/channel/press-releases/'),
('Newsletters | The Atlantic', 'http://www.theatlantic.com/feed/channel/newsletters/'),
('The Atlantic Photo', 'http://feeds.feedburner.com/theatlantic/infocus'),
('Notes | The Atlantic', 'http://feeds.feedburner.com/TheAtlanticNotes'),
('The Atlantic', 'https://www.theatlantic.com/feed/all/'),
('Best of The Atlantic', 'https://www.theatlantic.com/feed/best-of/'),
('Politics | The Atlantic', 'https://www.theatlantic.com/feed/channel/politics/'),
('Business | The Atlantic', 'https://www.theatlantic.com/feed/channel/business/'),
('Culture | The Atlantic', 'https://www.theatlantic.com/feed/channel/entertainment/'),
('Global | The Atlantic', 'https://www.theatlantic.com/feed/channel/international/'),
('Technology | The Atlantic', 'https://www.theatlantic.com/feed/channel/technology/'),
('U.S. | The Atlantic', 'https://www.theatlantic.com/feed/channel/national/'),
('Health | The Atlantic', 'https://www.theatlantic.com/feed/channel/health/'),
('Video | The Atlantic', 'https://www.theatlantic.com/feed/channel/video/'),
('Sexes | The Atlantic', 'https://www.theatlantic.com/feed/channel/sexes/'),
('Education | The Atlantic', 'https://www.theatlantic.com/feed/channel/education/'),
('Science | The Atlantic', 'https://www.theatlantic.com/feed/channel/science/'),
('News | The Atlantic', 'https://www.theatlantic.com/feed/channel/news/'),
('Press Releases | The Atlantic', 'https://www.theatlantic.com/feed/channel/press-releases/'),
('Newsletters | The Atlantic', 'https://www.theatlantic.com/feed/channel/newsletters/'),
('The Atlantic Photo', 'https://feeds.feedburner.com/theatlantic/infocus'),
('Notes | The Atlantic', 'https://feeds.feedburner.com/TheAtlanticNotes'),
]
else:
def parse_index(self):
@ -140,9 +140,11 @@ class TheAtlantic(BasicNewsRecipe):
elif 'hed' in cls:
title = self.tag_to_string(h2)
a = h2.findParent('a', href=True)
if a is None:
continue
url = a['href']
if url.startswith('/'):
url = 'http://www.theatlantic.com' + url
url = 'https://www.theatlantic.com' + url
li = a.findParent(
'li',
attrs={'class': lambda x: x and 'article' in x.split()}