Update Wall Street Journal

Merge branch 'patch-13' of https://github.com/bobbysteel/calibre
This commit is contained in:
Kovid Goyal 2017-06-19 20:30:08 +05:30
commit 63b8056af1
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -67,8 +67,10 @@ class WSJ(BasicNewsRecipe):
]
remove_tags = [
classes(
'insetButton insettipBox author-info media-object-video article_tools nc-exp-artmeta category'),
dict(id='right-rail'),
dict(id='narrator-nav'),
dict(name='div', id='ad_and_popular'),
classes('right-rail comments-count-container insetButton insettipBox author-info media-object-video article_tools nc-exp-artmeta category'),
dict(name='span', attrs={
'data-country-code': True, 'data-ticker-code': True}),
dict(name='meta link'.split()),
@ -95,6 +97,21 @@ class WSJ(BasicNewsRecipe):
self.log.debug('Found %d dynamic images in:' % found)
return soup
def get_cover_url(self):
cover = 'https://vir.wsj.net/fp/cdn/fp/assets/images/WSJ_A1.jpg'
br = BasicNewsRecipe.get_browser(self)
try:
br.open(cover)
except:
index = 'http://en.kiosko.net/us/np/wsj.html'
soup = self.index_to_soup(index)
for image in soup.findAll('img', src=True):
if image['src'].endswith('750.jpg'):
return image['src']
self.log("\nCover unavailable")
cover = None
return cover
def get_browser(self):
# To understand the signin logic read signin.js from
# https://id.wsj.com/access/pages/wsj/us/signin.html