diff --git a/dosagelib/plugins/g.py b/dosagelib/plugins/g.py index 7e622181a..c60c7ed05 100644 --- a/dosagelib/plugins/g.py +++ b/dosagelib/plugins/g.py @@ -1,6 +1,7 @@ -# -*- coding: iso-8859-1 -*- +# -*- coding: utf-8 -*- # Copyright (C) 2004-2005 Tristan Seligmann and Jonathan Jacobs # Copyright (C) 2012-2014 Bastian Kleineidam +# Copyright (C) 2015-2016 Tobias Gruetzmacher from re import compile, escape @@ -23,20 +24,24 @@ class Garanos(_BasicScraper): baseUrl = 'http://garanos.alexheberling.com/' rurl = escape(baseUrl) url = baseUrl + 'pages/page-1/' - starter = indirectStarter(url, - compile(tagre("a", "href", r'(%spages/[^"]+)' % rurl, after="nav-last"))) + starter = indirectStarter( + url, compile(tagre("a", "href", r'(%spages/[^"]+)' % rurl, + after="nav-last"))) stripUrl = baseUrl + 'pages/page-%s' - imageSearch = compile(tagre("img", "src", r'(%swp-content/uploads/sites/\d+/\d+/\d+/[^"]+)' % rurl)) - prevSearch = compile(tagre("a", "href", r'(%spages/[^"]+)' % rurl, after="prev")) + imageSearch = compile( + tagre("img", "src", + r'(%swp-content/uploads/sites/\d+/\d+/\d+/[^"]+)' % rurl)) + prevSearch = compile(tagre("a", "href", r'(%spages/[^"]+)' % rurl, + after="prev")) help = 'Index format: n (unpadded)' -class GastroPhobia(_BasicScraper): +class GastroPhobia(_ParserScraper): url = 'http://www.gastrophobia.com/' stripUrl = url + 'index.php?date=%s' firstStripUrl = stripUrl % '2008-07-30' - imageSearch = compile(r']*>(?!
)') - prevSearch = compile(r'« Previous') help = 'Index format: nnn' @@ -55,50 +61,36 @@ class GeeksNextDoor(_BasicScraper): firstStripUrl = stripUrl % '2010-10-04' imageSearch = compile(tagre("img", "src", r'(images/GND\d+[^"]+)')) prevSearch = compile(tagre("a", "href", r'(\d+-\d+-\d+\.html)') + - tagre("img", "src", r'images/nav_prev\.png')) + tagre("img", "src", r'images/nav_prev\.png')) help = 'Index format: yyyy-mm-dd' -# 403 error when getting image files, disable for now -class _GeneralProtectionFault(_BasicScraper): - url = 'http://www.gpf-comics.com/' - rurl = escape(url) - stripUrl = url + 'archive/%s' - firstStripUrl = stripUrl % '1998/11/02' - imageSearch = compile(tagre("img", "src", r'(/comics/[^"]*)')) - prevSearch = compile(tagre("a", "href", r'(%s[^"]+)' % rurl) + - tagre("img", "alt", "Previous Comic")) - help = 'Index format: yyyy/mm/dd' - - @classmethod - def namer(cls, imageUrl, pageUrl): - """Remove random stuff from filename.""" - imageName = imageUrl.split('/')[-1] - return imageName[:11] + imageName[-4:] - - class GirlGenius(_BasicScraper): baseUrl = 'http://www.girlgeniusonline.com/' rurl = escape(baseUrl) url = baseUrl + 'comic.php' stripUrl = url + '?date=%s' firstStripUrl = stripUrl % '20021104' - imageSearch = compile(tagre("img", "src", r"(%sggmain/strips/[^']*)" % rurl, quote="'")) + imageSearch = compile( + tagre("img", "src", r"(%sggmain/strips/[^']*)" % rurl, quote="'")) prevSearch = compile(tagre("a", "id", "topprev", quote="\"", - before=r"(%s[^\"']+)" % rurl)) + before=r"(%s[^\"']+)" % rurl)) multipleImagesPerStrip = True help = 'Index format: yyyymmdd' + class GirlsWithSlingshots(_BasicScraper): url = 'http://www.girlswithslingshots.com/' rurl = escape(url) - stripUrl = url + 'comic/%s/' + stripUrl = url + 'comic/%s' firstStripUrl = stripUrl % 'gws1' imageSearch = ( compile(tagre("img", "src", r'(%scomics/[^"]+)' % rurl)), - compile(tagre("img", "src", r'(http://cdn\.girlswithslingshots\.com/comics/[^"]+)')), + compile(tagre("img", "src", + r'(http://cdn\.girlswithslingshots\.com/comics/[^"]+)')), ) - prevSearch = compile(tagre("a", "href", r'(%scomic/[^"]+)' % rurl, after="prev")) + prevSearch = compile(tagre("a", "href", r'(%scomic/[^"]+)' % rurl, + after="prev")) help = 'Index format: stripname' @@ -107,7 +99,9 @@ class GlassHalfEmpty(_BasicScraper): stripUrl = url + '?strip_id=%s' firstStripUrl = stripUrl % '0' imageSearch = compile(r'src="(comics/.+?)"') - prevSearch = compile(tagre("a", "href", r'(\?strip_id=\d+)') + tagre("img", "src", r'\.\./images/arrowbuttons/onback\.jpg')) + prevSearch = compile( + tagre("a", "href", r'(\?strip_id=\d+)') + + tagre("img", "src", r'\.\./images/arrowbuttons/onback\.jpg')) help = 'Index format: nnn' @@ -116,8 +110,10 @@ class GleefulNihilism(_BasicScraper): rurl = escape(url) stripUrl = url + 'comic/%s/' firstStripUrl = stripUrl % 'amoeba' - imageSearch = compile(tagre("img", "src", r'(%swp-content/uploads/\d+/\d+/[^"]+)' % rurl)) - prevSearch = compile(tagre("a", "href", r'(%scomic/[^"]+)' % rurl) + '‹') + imageSearch = compile( + tagre("img", "src", r'(%swp-content/uploads/\d+/\d+/[^"]+)' % rurl)) + prevSearch = compile( + tagre("a", "href", r'(%scomic/[^"]+)' % rurl) + '‹') help = 'Index format: stripname' @@ -133,12 +129,14 @@ class GoblinsComic(_ParserScraper): class GoneWithTheBlastwave(_BasicScraper): url = 'http://www.blastwave-comic.com/index.php?p=comic&nro=1' - starter = indirectStarter(url, - compile(r'href="(index.php\?p=comic&nro=\d+)">' + + r'' + + r'