factorize mangatoshokan and simplyreadit (wip)

This commit is contained in:
Noé Rubinstein 2011-08-30 05:10:05 +02:00 committed by Romain Bignon
commit e5c1b1879b
3 changed files with 29 additions and 6 deletions

View file

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright(C) 2010-2011 Roger Philibert
# Copyright(C) 2010-2011 Noé Rubinstein
#
# This file is part of weboob.
#
@ -19,4 +19,4 @@
from .mangafox import MangafoxBackend
__all__ = ['MangafoxBackend']
__all__ = ['MangafoxBackend', 'MangatoshokanBackend', 'SimplyreaditBackend']

View file

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright(C) 2010-2011 Roger Philibert
# Copyright(C) 2010-2011 Noé Rubinstein
#
# This file is part of weboob.
#
@ -17,6 +17,18 @@
# You should have received a copy of the GNU Affero General Public License
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
from .backend import MangatoshokanBackend
from .backend import GenericComicReaderBackend, DisplayPage
__all__ = ['MangatoshokanBackend']
class MangatoshokanBackend(GenericComicReaderBackend):
NAME = 'mangatoshokan'
DESCRIPTION = 'Mangatoshokan manga reading site'
DOMAIN = "www.mangatoshokan.com"
IMG_SRC_XPATH = "//img[@id='readerPage']/@src"
PAGE_LIST_XPATH = "(//select[@class='headerSelect'])[1]/option/@value"
PAGE_TO_LOCATION = 'http://%s%%s' % DOMAIN
ID_TO_URL = 'http://www.mangatoshokan.com/read/%s'
ID_REGEXP = r'[^/]+(?:/[^/]+)*'
URL_REGEXP = r'.+mangatoshokan.com/read/(%s).+' % ID_REGEXP
PAGES = { r'http://.+\.mangatoshokan.com/read/.+': DisplayPage }

View file

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright(C) 2010-2011 Roger Philibert
# Copyright(C) 2010-2011 Noé Rubinstein
#
# This file is part of weboob.
#
@ -17,6 +17,17 @@
# You should have received a copy of the GNU Affero General Public License
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
from .backend import SimplyreaditBackend
from .backend import GenericComicReaderBackend, DisplayPage
__all__ = ['SimplyreaditBackend']
class SimplyreaditBackend(GenericComicReaderBackend):
NAME = 'simplyreadit'
DESCRIPTION = 'Simplyreadit manga reading site'
IMG_SRC_XPATH = "//img[@class='open']/@src"
PAGE_LIST_XPATH = "(//div[contains(@class,'dropdown_right')]/ul[@class='dropdown'])[1]/li/a/@href"
PAGE_TO_LOCATION = "%s"
ID_TO_URL = 'http://www.simplyread.it/reader/read/%s'
ID_REGEXP = r'[^/]+(?:/[^/]+)*'
URL_REGEXP = r'.+symplyread.it/reader/read/(%s)' % ID_REGEXP
PAGES = { r'http://.+\.simplyread.it/reader/read/.+': DisplayPage }