move id2url to tools
This commit is contained in:
parent
735b79a75d
commit
0667774952
12 changed files with 119 additions and 18 deletions
|
|
@ -23,6 +23,10 @@ from weboob.capabilities.video import ICapVideoProvider
|
|||
|
||||
from .browser import YoupornBrowser
|
||||
|
||||
|
||||
__all__ = ['YoupornBackend']
|
||||
|
||||
|
||||
class YoupornBackend(BaseBackend, ICapVideoProvider):
|
||||
NAME = 'youporn'
|
||||
MAINTAINER = 'Romain Bignon'
|
||||
|
|
@ -41,6 +45,13 @@ class YoupornBackend(BaseBackend, ICapVideoProvider):
|
|||
return self._browser
|
||||
raise AttributeError, name
|
||||
|
||||
@classmethod
|
||||
def id2url(cls, _id):
|
||||
if isinstance(_id, int) or isinstance(_id, (str,unicode)) and _id.isdigit():
|
||||
return 'http://www.youporn.com/watch/%d' % int(_id)
|
||||
else:
|
||||
return str(_id)
|
||||
|
||||
def need_url(func):
|
||||
def inner(self, *args, **kwargs):
|
||||
url = args[0]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue