mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #1938213 [recipe no longer works for downloading the free version of the Wall Street Journal](https://bugs.launchpad.net/calibre/+bug/1938213)
This commit is contained in:
parent
a81967e742
commit
96d5d5a764
@ -240,18 +240,19 @@ class WSJ(BasicNewsRecipe):
|
|||||||
break
|
break
|
||||||
|
|
||||||
feeds = []
|
feeds = []
|
||||||
for a in CSSSelect('.WSJTheme--nav-container--2qF6xQnZ .WSJTheme--section-link--3VznjgTM'):
|
for container in root.xpath('descendant::*[contains(@class, "WSJTheme--top-menu-item--")]'):
|
||||||
frontpage = a.get('href').endswith('frontpage')
|
for a in container.xpath('descendant::a[contains(@class, "WSJTheme--section-link--")]'):
|
||||||
title = self.tag_to_string(a).capitalize().strip().replace('U.s.', 'U.S.')
|
frontpage = a.get('href').endswith('frontpage')
|
||||||
if not title:
|
title = self.tag_to_string(a).capitalize().strip().replace('U.s.', 'U.S.')
|
||||||
continue
|
if not title:
|
||||||
url = self.abs_wsj_url(a.get('href'))
|
continue
|
||||||
self.log('Found section:', title, 'at', url)
|
url = self.abs_wsj_url(a.get('href'))
|
||||||
self.wsj_add_feed(feeds, title, url)
|
self.log('Found section:', title, 'at', url)
|
||||||
if frontpage:
|
self.wsj_add_feed(feeds, title, url)
|
||||||
self.wsj_find_wn_articles(feeds, root, CSSSelect)
|
if frontpage:
|
||||||
if self.test and len(feeds) >= self.test[0]:
|
self.wsj_find_wn_articles(feeds, root, CSSSelect)
|
||||||
break
|
if self.test and len(feeds) >= self.test[0]:
|
||||||
|
break
|
||||||
return feeds
|
return feeds
|
||||||
|
|
||||||
def test_wsj_index(self):
|
def test_wsj_index(self):
|
||||||
|
@ -240,18 +240,19 @@ class WSJ(BasicNewsRecipe):
|
|||||||
break
|
break
|
||||||
|
|
||||||
feeds = []
|
feeds = []
|
||||||
for a in CSSSelect('.WSJTheme--nav-container--2qF6xQnZ .WSJTheme--section-link--3VznjgTM'):
|
for container in root.xpath('descendant::*[contains(@class, "WSJTheme--top-menu-item--")]'):
|
||||||
frontpage = a.get('href').endswith('frontpage')
|
for a in container.xpath('descendant::a[contains(@class, "WSJTheme--section-link--")]'):
|
||||||
title = self.tag_to_string(a).capitalize().strip().replace('U.s.', 'U.S.')
|
frontpage = a.get('href').endswith('frontpage')
|
||||||
if not title:
|
title = self.tag_to_string(a).capitalize().strip().replace('U.s.', 'U.S.')
|
||||||
continue
|
if not title:
|
||||||
url = self.abs_wsj_url(a.get('href'))
|
continue
|
||||||
self.log('Found section:', title, 'at', url)
|
url = self.abs_wsj_url(a.get('href'))
|
||||||
self.wsj_add_feed(feeds, title, url)
|
self.log('Found section:', title, 'at', url)
|
||||||
if frontpage:
|
self.wsj_add_feed(feeds, title, url)
|
||||||
self.wsj_find_wn_articles(feeds, root, CSSSelect)
|
if frontpage:
|
||||||
if self.test and len(feeds) >= self.test[0]:
|
self.wsj_find_wn_articles(feeds, root, CSSSelect)
|
||||||
break
|
if self.test and len(feeds) >= self.test[0]:
|
||||||
|
break
|
||||||
return feeds
|
return feeds
|
||||||
|
|
||||||
def test_wsj_index(self):
|
def test_wsj_index(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user