2016-04-01 22:14:31 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
# Copyright (C) 2004-2005 Tristan Seligmann and Jonathan Jacobs
|
2014-01-05 15:50:57 +00:00
|
|
|
# Copyright (C) 2012-2014 Bastian Kleineidam
|
2016-04-01 22:14:31 +00:00
|
|
|
# Copyright (C) 2015-2016 Tobias Gruetzmacher
|
|
|
|
|
|
|
|
from __future__ import absolute_import, division, print_function
|
2012-06-20 19:58:13 +00:00
|
|
|
|
2013-04-10 16:19:11 +00:00
|
|
|
from re import compile, escape
|
2016-04-01 22:14:31 +00:00
|
|
|
from ..scraper import _BasicScraper
|
2014-07-23 18:53:59 +00:00
|
|
|
from ..util import tagre
|
2013-03-06 19:00:30 +00:00
|
|
|
from ..helpers import bounceStarter
|
2016-04-01 22:14:31 +00:00
|
|
|
from .common import _WordPressScraper
|
2013-03-06 19:00:30 +00:00
|
|
|
|
|
|
|
|
2013-03-26 16:35:10 +00:00
|
|
|
class HagarTheHorrible(_BasicScraper):
|
|
|
|
url = 'http://www.hagarthehorrible.net/'
|
|
|
|
stripUrl = 'http://www.hagardunor.net/comicstrips_us.php?serietype=9&colortype=1&serieno=%s'
|
|
|
|
firstStripUrl = stripUrl % '1'
|
|
|
|
multipleImagesPerStrip = True
|
2013-03-26 19:12:26 +00:00
|
|
|
imageSearch = compile(tagre("img", "src", r'(stripus\d+/(?:Hagar_The_Horrible_?|h)\d+[^ >]+)', quote=""))
|
2013-03-26 16:35:10 +00:00
|
|
|
prevUrl = r'(comicstrips_us\.php\?serietype\=9\&colortype\=1\&serieno\=\d+)'
|
|
|
|
prevSearch = compile(tagre("a", "href", prevUrl, after="Previous"))
|
|
|
|
help = 'Index format: number'
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def starter(cls):
|
|
|
|
"""Return last gallery link."""
|
|
|
|
url = 'http://www.hagardunor.net/comics.php'
|
2014-07-23 18:53:59 +00:00
|
|
|
data = cls.getPage(url)
|
2013-03-26 16:35:10 +00:00
|
|
|
pattern = compile(tagre("a", "href", cls.prevUrl))
|
2014-07-23 18:53:59 +00:00
|
|
|
for starturl in cls.fetchUrls(url, data, pattern):
|
2013-03-26 16:35:10 +00:00
|
|
|
pass
|
|
|
|
return starturl
|
|
|
|
|
|
|
|
|
2016-04-12 06:21:06 +00:00
|
|
|
# "Hiatus", navigation missing
|
|
|
|
class _HappyJar(_WordPressScraper):
|
2016-04-01 22:14:31 +00:00
|
|
|
url = 'http://www.happyjar.com/'
|
|
|
|
|
|
|
|
|
2013-03-06 19:00:30 +00:00
|
|
|
class HarkAVagrant(_BasicScraper):
|
|
|
|
url = 'http://www.harkavagrant.com/'
|
2013-04-10 16:19:11 +00:00
|
|
|
rurl = escape(url)
|
2016-04-12 21:11:39 +00:00
|
|
|
starter = bounceStarter()
|
2013-03-06 19:00:30 +00:00
|
|
|
stripUrl = url + 'index.php?id=%s'
|
|
|
|
firstStripUrl = stripUrl % '1'
|
2016-04-01 22:14:31 +00:00
|
|
|
imageSearch = compile(tagre("img", "src", r'(%s[^"]+)' % rurl,
|
|
|
|
after='BORDER'))
|
2013-04-10 16:19:11 +00:00
|
|
|
prevSearch = compile(tagre("a", "href", r'(%sindex\.php\?id=\d+)' % rurl) +
|
2016-04-01 22:14:31 +00:00
|
|
|
tagre("img", "src", "buttonprevious.png"))
|
2016-04-12 21:11:39 +00:00
|
|
|
nextSearch = compile(tagre("a", "href", r'(%sindex\.php\?id=\d+)' % rurl) +
|
|
|
|
tagre("img", "src", "buttonnext.png"))
|
2013-03-06 19:00:30 +00:00
|
|
|
help = 'Index format: number'
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def namer(cls, imageUrl, pageUrl):
|
|
|
|
filename = imageUrl.rsplit('/', 1)[1]
|
|
|
|
num = pageUrl.rsplit('=', 1)[1]
|
|
|
|
return '%s-%s' % (num, filename)
|
2012-06-20 19:58:13 +00:00
|
|
|
|
|
|
|
|
2016-04-01 22:14:31 +00:00
|
|
|
class Hipsters(_WordPressScraper):
|
|
|
|
url = 'http://www.hipsters-comic.com/'
|
|
|
|
firstStripUrl = 'http://www.hipsters-comic.com/comic/hip01/'
|