Update Go Comics

This commit is contained in:
Kovid Goyal 2017-10-13 10:23:58 +05:30
parent 97ee60c5a0
commit 3809604157
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -552,11 +552,13 @@ class GoComics(BasicNewsRecipe):
pass
def parse_comic_page(self, content):
img = content.find('img')
a = content.find('a', itemprop='image')
if a is None:
raise StopIteration()
img = a.find('img')
if img is None:
raise StopIteration()
img['srcset'] = ''
a = content.find('a', title=True)
title_parts = a['title'].split()
title = ' '.join(title_parts[:-2])
return {'h1':title, 'date':title_parts[-1], 'img':str(img)}
@ -579,7 +581,7 @@ class GoComics(BasicNewsRecipe):
page_soup = self.index_to_soup(url)
if not page_soup:
break
content = page_soup.find(attrs={'class':'comic__image'})
content = page_soup.find(attrs={'class': lambda x: x and 'comic__image' in x.split()})
if content is None:
break
current_articles.append(self.parse_comic_page(content))