Move xpath_class to helpers module.
This commit is contained in:
parent
20ab279cde
commit
ebbb27d05d
25 changed files with 60 additions and 61 deletions
|
@ -1,7 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs
|
||||
# Copyright (C) 2012-2014 Bastian Kleineidam
|
||||
# Copyright (C) 2015-2016 Tobias Gruetzmacher
|
||||
# Copyright (C) 2015-2017 Tobias Gruetzmacher
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
|
||||
|
@ -52,3 +52,9 @@ def indirectStarter(self):
|
|||
data = self.getPage(url)
|
||||
newurl = self.fetchUrl(url, data, self.latestSearch)
|
||||
return self.link_modifier(url, newurl)
|
||||
|
||||
|
||||
def xpath_class(name):
|
||||
"""Returns an XPath expressions which finds a tag which has a specified
|
||||
class."""
|
||||
return 'contains(concat(" ", @class, " "), " %s ")' % name
|
||||
|
|
|
@ -9,8 +9,8 @@ from re import compile, escape, MULTILINE
|
|||
|
||||
from ..util import tagre
|
||||
from ..scraper import _BasicScraper, _ParserScraper
|
||||
from ..helpers import regexNamer, bounceStarter, indirectStarter
|
||||
from .common import _WordPressScraper, xpath_class, WP_LATEST_SEARCH
|
||||
from ..helpers import regexNamer, bounceStarter, indirectStarter, xpath_class
|
||||
from .common import _WordPressScraper, WP_LATEST_SEARCH
|
||||
|
||||
|
||||
class AbstruseGoose(_BasicScraper):
|
||||
|
|
|
@ -9,9 +9,9 @@ from re import compile, escape
|
|||
|
||||
from ..util import tagre
|
||||
from ..scraper import _BasicScraper, _ParserScraper
|
||||
from ..helpers import indirectStarter
|
||||
from ..helpers import indirectStarter, xpath_class
|
||||
from .common import (_ComicControlScraper, _WordPressScraper, _WPNaviIn,
|
||||
WP_PREV_SEARCH, xpath_class)
|
||||
WP_PREV_SEARCH)
|
||||
|
||||
|
||||
class BadassMuthas(_BasicScraper):
|
||||
|
|
|
@ -8,9 +8,9 @@ from __future__ import absolute_import, division, print_function
|
|||
from re import compile, escape
|
||||
|
||||
from ..scraper import _BasicScraper, _ParserScraper
|
||||
from ..helpers import bounceStarter, indirectStarter
|
||||
from ..helpers import bounceStarter, indirectStarter, xpath_class
|
||||
from ..util import tagre
|
||||
from .common import _TumblrScraper, _WordPressScraper, xpath_class
|
||||
from .common import _TumblrScraper, _WordPressScraper
|
||||
|
||||
|
||||
class CampComic(_BasicScraper):
|
||||
|
|
|
@ -8,8 +8,7 @@ from __future__ import absolute_import, division, print_function
|
|||
import os
|
||||
|
||||
from ..scraper import _ParserScraper
|
||||
from ..helpers import bounceStarter
|
||||
from .common import xpath_class
|
||||
from ..helpers import bounceStarter, xpath_class
|
||||
|
||||
XPATH_LINK = '//a[%s and contains(text(), "%s")]'
|
||||
XPATH_IMG = '//a[%s][img[contains(@alt, "%s")]]'
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs
|
||||
# Copyright (C) 2012-2014 Bastian Kleineidam
|
||||
# Copyright (C) 2015-2016 Tobias Gruetzmacher
|
||||
# Copyright (C) 2015-2017 Tobias Gruetzmacher
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
|
||||
from ..scraper import _ParserScraper
|
||||
from ..helpers import indirectStarter
|
||||
from ..helpers import indirectStarter, xpath_class
|
||||
|
||||
# Common base classes for comics with the same structure (same hosting
|
||||
# software, for example) go here. Since those are shared by many modules,
|
||||
|
@ -14,12 +14,6 @@ from ..helpers import indirectStarter
|
|||
# expression is for which comics.
|
||||
|
||||
|
||||
def xpath_class(name):
|
||||
"""Returns an XPath expressions which finds a tag which has a specified
|
||||
class."""
|
||||
return 'contains(concat(" ", @class, " "), " %s ")' % name
|
||||
|
||||
|
||||
WP_LATEST_SEARCH = '//a[%s]' % xpath_class('comic-nav-last')
|
||||
WP_PREV_SEARCH = '//a[%s]' % xpath_class('comic-nav-previous')
|
||||
|
||||
|
|
|
@ -8,9 +8,9 @@ from __future__ import absolute_import, division, print_function
|
|||
from re import compile, escape
|
||||
|
||||
from ..scraper import _BasicScraper, _ParserScraper
|
||||
from ..helpers import indirectStarter, bounceStarter
|
||||
from ..helpers import indirectStarter, bounceStarter, xpath_class
|
||||
from ..util import tagre
|
||||
from .common import _WordPressScraper, xpath_class
|
||||
from .common import _WordPressScraper
|
||||
|
||||
|
||||
class DamnLol(_ParserScraper):
|
||||
|
|
|
@ -8,10 +8,10 @@ from __future__ import absolute_import, division, print_function
|
|||
import os
|
||||
from re import compile, escape, IGNORECASE
|
||||
|
||||
from ..helpers import indirectStarter
|
||||
from ..helpers import indirectStarter, xpath_class
|
||||
from ..scraper import _BasicScraper, _ParserScraper
|
||||
from ..util import tagre
|
||||
from .common import _WordPressScraper, WP_LATEST_SEARCH, xpath_class
|
||||
from .common import _WordPressScraper, WP_LATEST_SEARCH
|
||||
|
||||
|
||||
class EarthsongSaga(_ParserScraper):
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs
|
||||
# Copyright (C) 2012-2014 Bastian Kleineidam
|
||||
# Copyright (C) 2015-2016 Tobias Gruetzmacher
|
||||
# Copyright (C) 2015-2017 Tobias Gruetzmacher
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
from re import compile, escape, IGNORECASE
|
||||
|
||||
from ..util import tagre
|
||||
from ..scraper import _BasicScraper, _ParserScraper
|
||||
from ..helpers import indirectStarter
|
||||
from .common import _WPNaviIn, _WordPressScraper, xpath_class
|
||||
from ..helpers import indirectStarter, xpath_class
|
||||
from .common import _WPNaviIn, _WordPressScraper
|
||||
|
||||
|
||||
class FalconTwin(_BasicScraper):
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs
|
||||
# Copyright (C) 2012-2014 Bastian Kleineidam
|
||||
# Copyright (C) 2015-2016 Tobias Gruetzmacher
|
||||
# Copyright (C) 2015-2017 Tobias Gruetzmacher
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
|
||||
from re import compile, escape
|
||||
|
||||
from ..scraper import _BasicScraper, _ParserScraper
|
||||
from ..helpers import indirectStarter
|
||||
from ..helpers import indirectStarter, xpath_class
|
||||
from ..util import tagre
|
||||
from .common import _ComicControlScraper, _WordPressScraper, xpath_class
|
||||
from .common import _ComicControlScraper, _WordPressScraper
|
||||
|
||||
|
||||
class Galaxion(_BasicScraper):
|
||||
|
|
|
@ -6,8 +6,7 @@
|
|||
from __future__ import absolute_import, division, print_function
|
||||
|
||||
from ..scraper import _ParserScraper
|
||||
from ..helpers import bounceStarter
|
||||
from .common import xpath_class
|
||||
from ..helpers import bounceStarter, xpath_class
|
||||
|
||||
|
||||
class GoComics(_ParserScraper):
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs
|
||||
# Copyright (C) 2012-2014 Bastian Kleineidam
|
||||
# Copyright (C) 2015-2016 Tobias Gruetzmacher
|
||||
# Copyright (C) 2015-2017 Tobias Gruetzmacher
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
|
||||
from re import compile, escape
|
||||
|
||||
from ..helpers import xpath_class
|
||||
from ..scraper import _BasicScraper
|
||||
from ..util import tagre
|
||||
from .common import _WordPressScraper, xpath_class
|
||||
from .common import _WordPressScraper
|
||||
|
||||
|
||||
class IAmArg(_BasicScraper):
|
||||
|
|
|
@ -9,8 +9,8 @@ from re import compile, escape
|
|||
|
||||
from ..scraper import _BasicScraper, _ParserScraper
|
||||
from ..util import tagre
|
||||
from ..helpers import indirectStarter
|
||||
from .common import _ComicControlScraper, xpath_class
|
||||
from ..helpers import indirectStarter, xpath_class
|
||||
from .common import _ComicControlScraper
|
||||
|
||||
|
||||
class JackCannon(_BasicScraper):
|
||||
|
|
|
@ -7,9 +7,10 @@ from __future__ import absolute_import, division, print_function
|
|||
|
||||
from re import compile, escape, IGNORECASE
|
||||
|
||||
from ..helpers import xpath_class
|
||||
from ..scraper import _BasicScraper
|
||||
from ..util import tagre
|
||||
from .common import _ComicControlScraper, _WordPressScraper, xpath_class
|
||||
from .common import _ComicControlScraper, _WordPressScraper
|
||||
|
||||
|
||||
class KevinAndKell(_BasicScraper):
|
||||
|
|
|
@ -7,9 +7,10 @@ from __future__ import absolute_import, division, print_function
|
|||
|
||||
from re import compile, escape, IGNORECASE
|
||||
|
||||
from ..helpers import xpath_class
|
||||
from ..scraper import _BasicScraper, _ParserScraper
|
||||
from ..util import tagre
|
||||
from .common import _ComicControlScraper, _WordPressScraper, xpath_class
|
||||
from .common import _ComicControlScraper, _WordPressScraper
|
||||
|
||||
|
||||
class MacHall(_BasicScraper):
|
||||
|
|
|
@ -1,17 +1,16 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs
|
||||
# Copyright (C) 2012-2014 Bastian Kleineidam
|
||||
# Copyright (C) 2015-2016 Tobias Gruetzmacher
|
||||
# Copyright (C) 2015-2017 Tobias Gruetzmacher
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
|
||||
from re import compile, escape
|
||||
|
||||
from ..scraper import _BasicScraper, _ParserScraper
|
||||
from ..helpers import indirectStarter
|
||||
from ..helpers import indirectStarter, xpath_class
|
||||
from ..util import tagre
|
||||
from .common import (_ComicControlScraper, _WordPressScraper, WP_LATEST_SEARCH,
|
||||
xpath_class)
|
||||
from .common import _ComicControlScraper, _WordPressScraper, WP_LATEST_SEARCH
|
||||
|
||||
|
||||
class Namesake(_ComicControlScraper):
|
||||
|
|
|
@ -7,9 +7,10 @@ from __future__ import absolute_import, division, print_function
|
|||
|
||||
from re import compile, escape
|
||||
|
||||
from ..helpers import xpath_class
|
||||
from ..scraper import _BasicScraper, _ParserScraper
|
||||
from ..util import tagre
|
||||
from .common import _WordPressScraper, xpath_class
|
||||
from .common import _WordPressScraper
|
||||
|
||||
|
||||
class OctopusPie(_ParserScraper):
|
||||
|
|
|
@ -8,9 +8,9 @@ from __future__ import absolute_import, division, print_function
|
|||
from re import compile, escape
|
||||
|
||||
from ..scraper import _BasicScraper, _ParserScraper
|
||||
from ..helpers import bounceStarter, queryNamer, indirectStarter
|
||||
from ..helpers import bounceStarter, queryNamer, indirectStarter, xpath_class
|
||||
from ..util import tagre
|
||||
from .common import _ComicControlScraper, _WordPressScraper, xpath_class
|
||||
from .common import _ComicControlScraper, _WordPressScraper
|
||||
|
||||
|
||||
class PandyLand(_WordPressScraper):
|
||||
|
|
|
@ -1,16 +1,17 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs
|
||||
# Copyright (C) 2012-2014 Bastian Kleineidam
|
||||
# Copyright (C) 2015-2016 Tobias Gruetzmacher
|
||||
# Copyright (C) 2015-2017 Tobias Gruetzmacher
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
|
||||
from re import compile
|
||||
from six.moves.urllib.parse import urljoin
|
||||
|
||||
from ..helpers import xpath_class
|
||||
from ..scraper import _BasicScraper, _ParserScraper
|
||||
from ..util import tagre
|
||||
from .common import _WordPressScraper, xpath_class
|
||||
from .common import _WordPressScraper
|
||||
|
||||
|
||||
class RadioactivePanda(_BasicScraper):
|
||||
|
|
|
@ -10,10 +10,9 @@ from os.path import splitext
|
|||
import datetime
|
||||
|
||||
from ..scraper import _BasicScraper, _ParserScraper
|
||||
from ..helpers import indirectStarter, bounceStarter
|
||||
from ..helpers import indirectStarter, bounceStarter, xpath_class
|
||||
from ..util import tagre
|
||||
from .common import (_ComicControlScraper, _WordPressScraper, WP_LATEST_SEARCH,
|
||||
xpath_class)
|
||||
from .common import _ComicControlScraper, _WordPressScraper, WP_LATEST_SEARCH
|
||||
|
||||
|
||||
class SabrinaOnline(_BasicScraper):
|
||||
|
|
|
@ -1,17 +1,16 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs
|
||||
# Copyright (C) 2012-2014 Bastian Kleineidam
|
||||
# Copyright (C) 2015-2016 Tobias Gruetzmacher
|
||||
# Copyright (C) 2015-2017 Tobias Gruetzmacher
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
|
||||
from re import compile, escape, IGNORECASE
|
||||
|
||||
from ..scraper import _BasicScraper, _ParserScraper
|
||||
from ..helpers import indirectStarter
|
||||
from ..helpers import indirectStarter, xpath_class
|
||||
from ..util import tagre
|
||||
from .common import (_ComicControlScraper, _TumblrScraper, _WordPressScraper,
|
||||
xpath_class)
|
||||
from .common import _ComicControlScraper, _TumblrScraper, _WordPressScraper
|
||||
|
||||
|
||||
class TheBrads(_ParserScraper):
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs
|
||||
# Copyright (C) 2012-2014 Bastian Kleineidam
|
||||
# Copyright (C) 2015-2016 Tobias Gruetzmacher
|
||||
# Copyright (C) 2015-2017 Tobias Gruetzmacher
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
|
||||
from re import compile, escape
|
||||
|
||||
from ..scraper import _BasicScraper
|
||||
from ..helpers import indirectStarter
|
||||
from ..helpers import indirectStarter, xpath_class
|
||||
from ..util import tagre
|
||||
from .common import _WordPressScraper, xpath_class
|
||||
from .common import _WordPressScraper
|
||||
|
||||
|
||||
class Underling(_WordPressScraper):
|
||||
|
|
|
@ -7,9 +7,8 @@ from __future__ import absolute_import, division, print_function
|
|||
from re import compile
|
||||
|
||||
from ..scraper import _BasicScraper, _ParserScraper
|
||||
from ..helpers import indirectStarter
|
||||
from ..helpers import indirectStarter, xpath_class
|
||||
from ..util import tagre
|
||||
from .common import xpath_class
|
||||
|
||||
|
||||
class VampireCheerleaders(_BasicScraper):
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs
|
||||
# Copyright (C) 2012-2014 Bastian Kleineidam
|
||||
# Copyright (C) 2015-2016 Tobias Gruetzmacher
|
||||
# Copyright (C) 2015-2017 Tobias Gruetzmacher
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
|
||||
|
@ -9,8 +9,8 @@ from re import compile, escape, IGNORECASE
|
|||
|
||||
from ..scraper import _BasicScraper, _ParserScraper
|
||||
from ..util import tagre
|
||||
from ..helpers import indirectStarter
|
||||
from .common import _ComicControlScraper, _WordPressScraper, xpath_class
|
||||
from ..helpers import indirectStarter, xpath_class
|
||||
from .common import _ComicControlScraper, _WordPressScraper
|
||||
|
||||
|
||||
class WapsiSquare(_WordPressScraper):
|
||||
|
|
|
@ -9,8 +9,8 @@ from re import compile, escape
|
|||
|
||||
from ..scraper import _BasicScraper, _ParserScraper
|
||||
from ..util import tagre
|
||||
from ..helpers import bounceStarter
|
||||
from .common import _WordPressScraper, xpath_class
|
||||
from ..helpers import bounceStarter, xpath_class
|
||||
from .common import _WordPressScraper
|
||||
|
||||
|
||||
class ZapComic(_ParserScraper):
|
||||
|
|
Loading…
Reference in a new issue