Fix for no articles returned

May need further cleaning but at least returns articles now.
Fixes https://bugs.launchpad.net/calibre/+bug/1674042
This commit is contained in:
bobbysteel 2017-07-05 22:42:39 +01:00 committed by GitHub
parent a060fae673
commit 1572ca42a7

View File

@ -70,19 +70,8 @@ class Politico(BasicNewsRecipe):
del item['style'] del item['style']
return soup return soup
url_pat = re.compile(r'<a href="([^"]+print.*\.cfm[^"]+)"')
def postprocess_html(self, soup, first): def postprocess_html(self, soup, first):
for tag in soup.findAll(name=['table', 'tr', 'td']): for tag in soup.findAll(name=['table', 'tr', 'td']):
tag.name = 'div' tag.name = 'div'
return soup return soup
def print_version(self, url):
raw = self.index_to_soup(url, raw=True)
try:
url = self.url_pat.search(raw).group(1)
except:
traceback.print_exc()
url = None
return url