mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
recipes: gosc_niedzielny - add content not assigned to columns
This commit is contained in:
parent
9c7f9e5786
commit
298d7cec05
@ -19,6 +19,7 @@ class GN(BasicNewsRecipe):
|
|||||||
no_stylesheets = True
|
no_stylesheets = True
|
||||||
language = 'pl'
|
language = 'pl'
|
||||||
remove_javascript = True
|
remove_javascript = True
|
||||||
|
ignore_duplicate_articles = {'url'}
|
||||||
masthead_url = 'http://m.gosc.pl/static/themes/czerwony_gosc-mobile/logo.png'
|
masthead_url = 'http://m.gosc.pl/static/themes/czerwony_gosc-mobile/logo.png'
|
||||||
|
|
||||||
def find_last_issue(self):
|
def find_last_issue(self):
|
||||||
@ -46,7 +47,7 @@ class GN(BasicNewsRecipe):
|
|||||||
'description': self.tag_to_string(a.find('p', attrs={'class': 'b lead'}))
|
'description': self.tag_to_string(a.find('p', attrs={'class': 'b lead'}))
|
||||||
}]
|
}]
|
||||||
feeds.append((u'Na dobry początek', articles))
|
feeds.append((u'Na dobry początek', articles))
|
||||||
# kategorie
|
# columns:
|
||||||
for addr in soup.findAll('a', attrs={'href': re.compile('kategoria')}):
|
for addr in soup.findAll('a', attrs={'href': re.compile('kategoria')}):
|
||||||
if addr.string != u'wszystkie artyku\u0142y z tej kategorii \xbb':
|
if addr.string != u'wszystkie artyku\u0142y z tej kategorii \xbb':
|
||||||
main_block = self.index_to_soup(
|
main_block = self.index_to_soup(
|
||||||
@ -55,6 +56,20 @@ class GN(BasicNewsRecipe):
|
|||||||
if len(articles) > 0:
|
if len(articles) > 0:
|
||||||
section = addr.string
|
section = addr.string
|
||||||
feeds.append((section, articles))
|
feeds.append((section, articles))
|
||||||
|
# not assigned content:
|
||||||
|
page = 1
|
||||||
|
not_assigned = []
|
||||||
|
while True:
|
||||||
|
soup = self.index_to_soup(
|
||||||
|
'http://gosc.pl' + self.last_issue.replace('przeglad', 'wszystko') + '/' + str(page))
|
||||||
|
articles = list(self.find_articles(soup))
|
||||||
|
not_assigned.extend(articles)
|
||||||
|
page += 1
|
||||||
|
pages = soup.find('span', attrs={'class': 'pgr_nrs'})
|
||||||
|
if str(page) not in [self.tag_to_string(x)[1] for x in pages.findAll('a')]:
|
||||||
|
break
|
||||||
|
|
||||||
|
feeds.append((u'Nieprzypisane', not_assigned))
|
||||||
return feeds
|
return feeds
|
||||||
|
|
||||||
def find_articles(self, main_block):
|
def find_articles(self, main_block):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user