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 YoujizzBrowser
|
||||
|
||||
|
||||
__all__ = ['YoujizzBackend']
|
||||
|
||||
|
||||
class YoujizzBackend(BaseBackend, ICapVideoProvider):
|
||||
NAME = 'youjizz'
|
||||
MAINTAINER = 'Roger Philibert'
|
||||
|
|
@ -41,6 +45,10 @@ class YoujizzBackend(BaseBackend, ICapVideoProvider):
|
|||
return self._browser
|
||||
raise AttributeError, name
|
||||
|
||||
@classmethod
|
||||
def id2url(cls, _id):
|
||||
return 'http://www.youjizz.com/videos/%s.html' % _id
|
||||
|
||||
def check_url(func):
|
||||
def inner(self, *args, **kwargs):
|
||||
url = args[0]
|
||||
|
|
|
|||
|
|
@ -37,9 +37,6 @@ class YoujizzBrowser(BaseBrowser):
|
|||
r'http://.*youjizz\.com/search/.+\.html': IndexPage,
|
||||
}
|
||||
|
||||
def id2url(self, _id):
|
||||
return 'http://www.youjizz.com/videos/%s.html' % _id
|
||||
|
||||
def get_video(self, url):
|
||||
self.location(url)
|
||||
return self.page.video
|
||||
|
|
|
|||
|
|
@ -23,6 +23,8 @@ import re
|
|||
from weboob.capabilities.video import Video
|
||||
from weboob.tools.browser import BasePage
|
||||
|
||||
from .. import tools
|
||||
|
||||
|
||||
__all__ = ['IndexPage']
|
||||
|
||||
|
|
@ -59,4 +61,5 @@ class IndexPage(BasePage):
|
|||
title=title,
|
||||
duration=duration,
|
||||
preview_url=preview_url,
|
||||
nsfw=True)
|
||||
nsfw=True,
|
||||
id2url=tools.id2url)
|
||||
|
|
|
|||
22
weboob/backends/youjizz/tools.py
Normal file
22
weboob/backends/youjizz/tools.py
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
Copyright(C) 2010 Roger Philibert
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, version 3 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
"""
|
||||
|
||||
def id2url(_id):
|
||||
return 'http://www.youjizz.com/videos/%s.html' % _id
|
||||
Loading…
Add table
Add a link
Reference in a new issue