mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Update Wall Street Journal
Merge branch 'patch-13' of https://github.com/bobbysteel/calibre
This commit is contained in:
commit
63b8056af1
@ -67,8 +67,10 @@ class WSJ(BasicNewsRecipe):
|
|||||||
]
|
]
|
||||||
|
|
||||||
remove_tags = [
|
remove_tags = [
|
||||||
classes(
|
dict(id='right-rail'),
|
||||||
'insetButton insettipBox author-info media-object-video article_tools nc-exp-artmeta category'),
|
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={
|
dict(name='span', attrs={
|
||||||
'data-country-code': True, 'data-ticker-code': True}),
|
'data-country-code': True, 'data-ticker-code': True}),
|
||||||
dict(name='meta link'.split()),
|
dict(name='meta link'.split()),
|
||||||
@ -95,6 +97,21 @@ class WSJ(BasicNewsRecipe):
|
|||||||
self.log.debug('Found %d dynamic images in:' % found)
|
self.log.debug('Found %d dynamic images in:' % found)
|
||||||
return soup
|
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):
|
def get_browser(self):
|
||||||
# To understand the signin logic read signin.js from
|
# To understand the signin logic read signin.js from
|
||||||
# https://id.wsj.com/access/pages/wsj/us/signin.html
|
# https://id.wsj.com/access/pages/wsj/us/signin.html
|
||||||
|
Loading…
x
Reference in New Issue
Block a user