save link to last number in a variable instead of finding it out again and again

This commit is contained in:
Tomasz Długosz 2014-02-21 20:14:01 +01:00
parent f6b32541e6
commit b59c3778a3

View File

@ -30,7 +30,8 @@ class GN(BasicNewsRecipe):
return page[4]
def parse_index(self):
soup = self.index_to_soup('http://gosc.pl' + self.find_last_issue())
self.last_issue = self.find_last_issue()
soup = self.index_to_soup('http://gosc.pl' + self.last_issue)
self.cover_url = 'http://www.gosc.pl' + soup.find('div',attrs={'class':'fl-w100 release-wp'}).findAll('a')[-4].contents[0]['src']
feeds = []
enlisted = []
@ -57,7 +58,7 @@ class GN(BasicNewsRecipe):
page = 1
not_assigned = []
while True:
soup = self.index_to_soup('http://gosc.pl' + self.find_last_issue().replace('przeglad','wszystko') + '/' + str(page))
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([x for x in articles if x.get('url') not in enlisted])
page+=1