Fix many CapVideo-related ConversionWarnings

This commit is contained in:
Laurent Bachelier 2012-11-09 13:06:08 +01:00 committed by Romain Bignon
commit 1f310a3d33
14 changed files with 23 additions and 22 deletions

View file

@ -44,9 +44,9 @@ class SearchPage(BasePage):
video = InaVideo('boutique.%s' % id)
video.thumbnail = Thumbnail('http://boutique.ina.fr%s' % li.find('a').find('img').attrib['src'])
video.thumbnail = Thumbnail(u'http://boutique.ina.fr%s' % li.find('a').find('img').attrib['src'])
video.title = self.parser.select(li, 'p.titre', 1).text
video.title = unicode(self.parser.select(li, 'p.titre', 1).text)
date = self.parser.select(li, 'p.date', 1).text
day, month, year = [int(s) for s in date.split('/')]

View file

@ -60,7 +60,7 @@ class BaseVideoPage(BasePage):
qs = parse_qs(self.document.getroot().cssselect('param[name="flashvars"]')[0].attrib['value'])
s = self.browser.readurl('http://boutique.ina.fr/player/infovideo/id_notice/%s' % qs['id_notice'][0])
s = s[s.find('<Media>')+7:s.find('</Media>')]
return '%s/pkey/%s' % (s, qs['pkey'][0])
return u'%s/pkey/%s' % (s, qs['pkey'][0])
def parse_date_and_duration(self, text):
duration_regexp = re.compile('(.* - )?(.+) - ((.+)h)?((.+)min)?(.+)s')
@ -99,10 +99,10 @@ class VideoPage(BaseVideoPage):
def get_title(self):
qr = self.parser.select(self.document.getroot(), 'div.container-global-qr')[0].find('div').findall('div')[1]
return qr.find('h2').text.strip()
return unicode(qr.find('h2').text.strip())
def get_description(self):
return self.parser.select(self.document.getroot(), 'div.container-global-qr')[1].find('div').find('p').text.strip()
return unicode(self.parser.select(self.document.getroot(), 'div.container-global-qr')[1].find('div').find('p').text.strip())
class BoutiqueVideoPage(BaseVideoPage):
@ -114,7 +114,7 @@ class BoutiqueVideoPage(BaseVideoPage):
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()
return unicode(el.text.strip())
def get_date_and_duration(self):
el = self.document.getroot().cssselect('div.bloc-produit-haut p.date')[0]