move id2url to tools

This commit is contained in:
Christophe Benz 2010-04-27 12:19:48 +02:00 committed by Romain Bignon
commit 0667774952
12 changed files with 119 additions and 18 deletions

View file

@ -22,6 +22,7 @@ import urllib
from weboob.tools.browser import BaseBrowser
from . import tools
from .pages import VideoPage
__all__ = ['YoutubeBrowser']
@ -30,9 +31,6 @@ class YoutubeBrowser(BaseBrowser):
PAGES = {'.*youtube\.com/watch\?v=(.+)': VideoPage,
}
def id2url(self, _id):
return _id if 'youtube.com' in _id else 'http://www.youtube.com/watch?v=%s' % _id
def get_video(self, _id):
self.location(self.id2url(_id))
self.location(tools.id2url(_id))
return self.page.video