rewrite video decorators to be in browser

This commit is contained in:
Christophe Benz 2010-05-20 11:46:00 +02:00 committed by Romain Bignon
commit 0de0f2a768
19 changed files with 167 additions and 119 deletions

View file

@ -32,7 +32,7 @@ class VideoPage(BasePage):
VIDEO_SIGNATURE_REGEX = re.compile(r'&t=([^ ,&]*)')
def on_loaded(self):
self.video = YoutubeVideo(u'youtube:%s' % self.get_id())
self.video = YoutubeVideo(self.get_id())
self.video.title = self.get_title()
self.video.url = self.get_url()
self.set_details(self.video)
@ -51,7 +51,7 @@ class VideoPage(BasePage):
continue
for m in re.finditer(self.VIDEO_SIGNATURE_REGEX, data.text):
video_signature = m.group(1)
return 'http://www.youtube.com/get_video?video_id=%s&t=%s&fmt=18' % (self.video.id, video_signature)
return 'http://www.youtube.com/get_video?video_id=%s&t=%s&fmt=18' % (self.video.provider_id, video_signature)
def get_title(self):
found = self.document.getroot().cssselect('meta[name=title]')