fix parsing authors on anyclip videos

This commit is contained in:
Romain Bignon 2012-06-08 11:24:57 +02:00
commit 9294f3e964
2 changed files with 7 additions and 5 deletions

View file

@ -92,14 +92,16 @@ class VideoPage(BasePage):
div = self.parser.select(self.document.getroot(), 'div#content', 1)
video.title = self.parser.select(div, 'span.title', 1).text
video.author = self.parser.select(div, 'a.name', 1).text
video.title = unicode(self.parser.select(div, 'span.title', 1).text)
video.author = unicode(self.parser.select(div, 'a.name, span.name', 1).text)
try:
video.description = self.parser.select(div, 'div#video_description', 1).text
video.description = unicode(self.parser.select(div, 'div#video_description', 1).text)
except BrokenPageError:
video.description = u''
for script in self.parser.select(self.document.getroot(), 'div.dmco_html'):
if 'id' in script.attrib and script.attrib['id'].startswith('container_player_'):
# TODO support videos from anyclip, cf http://www.dailymotion.com/video/xkyjiv for example
if 'id' in script.attrib and script.attrib['id'].startswith('container_player_') and \
script.find('script') is not None:
text = script.find('script').text
mobj = re.search(r'(?i)addVariable\(\"video\"\s*,\s*\"([^\"]*)\"\)', text)
if mobj is None:

View file

@ -27,7 +27,7 @@ __all__ = ['DailymotionVideo']
class DailymotionVideo(BaseVideo):
def __init__(self, *args, **kwargs):
BaseVideo.__init__(self, *args, **kwargs)
self.ext = 'flv'
self.ext = u'flv'
@classmethod
def id2url(cls, _id):