new attribute 'description' on Video

This commit is contained in:
Romain Bignon 2010-11-04 22:23:00 +01:00
commit 0d640e17cc
2 changed files with 7 additions and 0 deletions

View file

@ -44,6 +44,7 @@ class VideoPage(BasePage):
video.url = self.get_url()
video.date = date
video.duration = duration
video.description = self.get_description()
return video
def get_id(self):
@ -53,6 +54,11 @@ class VideoPage(BasePage):
warning('Unable to parse ID')
return 0
def get_description(self):
el = self.document.getroot().cssselect('div.bloc-produit-haut div.contenu p')[0]
if el is not None:
return el.text.strip()
def get_date_and_duration(self):
duration_regexp = re.compile('(.+) - (.+)min(.+)s')
el = self.document.getroot().cssselect('div.bloc-produit-haut p.date')[0]

View file

@ -48,6 +48,7 @@ class BaseVideo(CapBaseObject):
self.add_field('title', basestring, title)
self.add_field('url', basestring, url)
self.add_field('author', basestring, author)
self.add_field('description', basestring)
self.add_field('duration', (int,long,timedelta), duration)
self.add_field('date', datetime, date)
self.add_field('rating', (int,long,float), rating)