2013-02-05 18:51:46 +00:00
|
|
|
# Copyright (C) 2012-2013 Bastian Kleineidam
|
2012-06-20 19:58:13 +00:00
|
|
|
|
2013-04-10 16:19:11 +00:00
|
|
|
from re import compile, escape
|
2012-10-11 10:03:12 +00:00
|
|
|
from ..scraper import _BasicScraper
|
2013-03-26 16:35:10 +00:00
|
|
|
from ..util import tagre, getPageContent, fetchUrls
|
2013-03-06 19:00:30 +00:00
|
|
|
from ..helpers import bounceStarter
|
|
|
|
|
|
|
|
|
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'
|
|
|
|
content = getPageContent(url, cls.session)[0]
|
|
|
|
pattern = compile(tagre("a", "href", cls.prevUrl))
|
|
|
|
for starturl in fetchUrls(url, content, url, pattern):
|
|
|
|
pass
|
|
|
|
return starturl
|
|
|
|
|
|
|
|
|
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)
|
2013-03-06 19:00:30 +00:00
|
|
|
starter = bounceStarter(url,
|
2013-04-10 16:19:11 +00:00
|
|
|
compile(tagre("a", "href", r'(%sindex\.php\?id=\d+)' % rurl) +
|
2013-03-06 19:00:30 +00:00
|
|
|
tagre("img", "src", "buttonnext.png")))
|
|
|
|
stripUrl = url + 'index.php?id=%s'
|
|
|
|
firstStripUrl = stripUrl % '1'
|
2013-04-10 16:19:11 +00:00
|
|
|
imageSearch = compile(tagre("img", "src", r'(%s[^"]+)' % rurl, after='BORDER'))
|
|
|
|
prevSearch = compile(tagre("a", "href", r'(%sindex\.php\?id=\d+)' % rurl) +
|
2013-03-06 19:00:30 +00:00
|
|
|
tagre("img", "src", "buttonprevious.png"))
|
|
|
|
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
|
|
|
|
|
|
|
|
2013-02-06 05:58:06 +00:00
|
|
|
class HijinksEnsue(_BasicScraper):
|
|
|
|
url = 'http://hijinksensue.com/'
|
2013-04-10 16:19:11 +00:00
|
|
|
rurl = escape(url)
|
2013-02-06 05:58:06 +00:00
|
|
|
stripUrl = url + '%s/'
|
2013-04-10 21:57:09 +00:00
|
|
|
firstStripUrl = stripUrl % '2007/05/11/a-soul-as-black-as-eyeliner'
|
2013-04-10 16:19:11 +00:00
|
|
|
imageSearch = compile(tagre("img", "src", r'(%scomics/\d+-\d+-\d+[^"]+)' % rurl))
|
|
|
|
prevSearch = compile(tagre("a", "href", r'(%s\d+/\d+/\d+/[^"]+)' % rurl, after="navi-prev"))
|
2013-04-10 21:57:09 +00:00
|
|
|
help = 'Index format: yyyy/mm/dd/stripname'
|
2013-02-06 05:58:06 +00:00
|
|
|
|
|
|
|
|
2013-03-21 17:33:16 +00:00
|
|
|
class Hipsters(_BasicScraper):
|
|
|
|
url = 'http://www.hipsters-comic.com/'
|
2013-04-10 16:19:11 +00:00
|
|
|
rurl = escape(url)
|
2013-03-21 17:33:16 +00:00
|
|
|
stripUrl = url + '%s/'
|
|
|
|
firstStripUrl = stripUrl % '2010/08/hip01'
|
2013-04-10 16:19:11 +00:00
|
|
|
imageSearch = compile(tagre("img", "src", r'(%scomics/\d+-\d+-\d+[^"]+)' % rurl))
|
|
|
|
prevSearch = compile(tagre("a", "href", r'(%s\d+/\d+/[^"]+)' % rurl, after="prev"))
|
2013-03-21 17:33:16 +00:00
|
|
|
help = 'Index format: yyyy/dd/stripname'
|
|
|
|
|
|
|
|
|
2012-06-20 19:58:13 +00:00
|
|
|
class HorribleVille(_BasicScraper):
|
2013-02-04 20:00:26 +00:00
|
|
|
url = 'http://horribleville.com/'
|
|
|
|
stripUrl = url + 'd/%s.html'
|
2013-04-10 21:57:09 +00:00
|
|
|
firstStripUrl = stripUrl % '20051220'
|
2012-11-21 20:57:26 +00:00
|
|
|
imageSearch = compile(tagre("img", "src", r'(/comics/[^"]+)'))
|
|
|
|
prevSearch = compile(tagre("a", "href", r'(/d/[^"]+)') + tagre("img", "src", r'/images/previous\.png'))
|
|
|
|
help = 'Index format: yyyymmdd'
|