Better check for daily links

This commit is contained in:
Florent 2013-07-29 12:23:27 +02:00
commit b0060b6a08

View file

@ -73,10 +73,9 @@ class DailyTitlesPage(PresseuropPage):
class DailySinglePage(PresseuropPage): class DailySinglePage(PresseuropPage):
def get_daily_date(self): def get_daily_date(self):
ul = self.document.getroot().xpath( plink = self.document.getroot().xpath("//p[@class='w200']")
"//ul[@class='carousel-skin carousel-today']") if len(plink) > 0:
if len(ul) > 0: link = plink[0].xpath('a')[0]
link = ul[0].xpath('li/a')[0]
date = link.attrib['href'].split('/')[3] date = link.attrib['href'].split('/')[3]
return date return date
return None return None