dosage/dosagelib/plugins/a.py

369 lines
12 KiB
Python
Raw Normal View History

# -*- coding: utf-8 -*-
2016-10-28 22:21:41 +00:00
# Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs
2014-01-05 15:50:57 +00:00
# Copyright (C) 2012-2014 Bastian Kleineidam
2018-05-22 22:54:40 +00:00
# Copyright (C) 2015-2018 Tobias Gruetzmacher
2012-11-21 20:57:26 +00:00
from __future__ import absolute_import, division, print_function
from re import compile, escape, MULTILINE
2012-09-26 12:42:28 +00:00
from ..util import tagre
2015-04-16 23:35:21 +00:00
from ..scraper import _BasicScraper, _ParserScraper
2017-05-21 23:17:05 +00:00
from ..helpers import regexNamer, bounceStarter, indirectStarter
2019-06-30 00:10:37 +00:00
from .common import _WordPressScraper, _WPNavi, _WPNaviIn, WP_LATEST_SEARCH
2012-06-20 19:58:13 +00:00
class AbstruseGoose(_BasicScraper):
2014-01-24 22:17:21 +00:00
url = 'http://abstrusegoose.com/'
rurl = escape(url)
starter = bounceStarter
stripUrl = url + '%s'
firstStripUrl = stripUrl % '1'
imageSearch = compile(tagre('img', 'src',
r'(http://abstrusegoose\.com/strips/[^<>"]+)'))
prevSearch = compile(tagre('a', 'href', r'(%s\d+)' % rurl) +
r'&laquo; Previous')
nextSearch = compile(tagre('a', 'href', r'(%s\d+)' % rurl) +
r'Next &raquo;')
2012-06-20 19:58:13 +00:00
help = 'Index format: n (unpadded)'
2013-12-04 02:56:54 +00:00
textSearch = compile(tagre("img", "title", r'([^"]+)'))
2012-06-20 19:58:13 +00:00
def namer(self, image_url, page_url):
2016-04-07 21:21:31 +00:00
index = int(page_url.rstrip('/').split('/')[-1])
name = image_url.split('/')[-1].split('.')[0]
2012-06-20 19:58:13 +00:00
return 'c%03d-%s' % (index, name)
class AbsurdNotions(_BasicScraper):
baseUrl = 'http://www.absurdnotions.org/'
url = baseUrl + 'page129.html'
stripUrl = baseUrl + 'page%s.html'
firstStripUrl = stripUrl % '1'
imageSearch = compile(tagre('img', 'src', r'(an[^"]+)'))
multipleImagesPerStrip = True
prevSearch = compile(tagre('a', 'href', r'([^"]+)') +
2018-05-22 22:54:40 +00:00
tagre('img', 'src', r'nprev\.gif'))
help = 'Index format: n (unpadded)'
2012-06-20 19:58:13 +00:00
class AcademyVale(_BasicScraper):
url = 'http://www.imagerie.com/vale/'
stripUrl = url + 'avarch.cgi?%s'
firstStripUrl = stripUrl % '001'
2012-11-13 05:51:54 +00:00
imageSearch = compile(tagre('img', 'src', r'(avale\d{4}-\d{2}\.gif)'))
prevSearch = compile(tagre('a', 'href', r'(avarch[^">]+)', quote="") +
2018-05-22 22:54:40 +00:00
tagre('img', 'src', r'AVNavBack\.gif'))
2012-06-20 19:58:13 +00:00
help = 'Index format: nnn'
2013-04-10 16:36:33 +00:00
class Achewood(_BasicScraper):
url = 'http://www.achewood.com/'
stripUrl = url + 'index.php?date=%s'
firstStripUrl = stripUrl % '00000000'
imageSearch = compile(tagre("img", "src", r'(/comic\.php\?date=\d+)'))
prevSearch = compile(tagre("a", "href", r'(index\.php\?date=\d+)',
after="Previous"))
2013-04-10 16:36:33 +00:00
help = 'Index format: mmddyyyy'
namer = regexNamer(compile(r'date=(\d+)'))
2017-05-21 23:17:05 +00:00
class AfterStrife(_WPNavi):
2013-04-13 18:58:00 +00:00
baseUrl = 'http://afterstrife.com/'
stripUrl = baseUrl + '?p=%s'
2013-04-10 21:57:09 +00:00
url = stripUrl % '262'
firstStripUrl = stripUrl % '1'
2013-04-10 16:36:33 +00:00
help = 'Index format: nnn'
endOfLife = True
2013-04-10 16:36:33 +00:00
class AGirlAndHerFed(_ParserScraper):
url = 'https://agirlandherfed.com/'
2013-04-10 16:36:33 +00:00
stripUrl = url + '1.%s.html'
firstStripUrl = stripUrl % '1'
imageSearch = '//div[@id="comic-image"]/img'
prevSearch = '//div[@id="comic-nav"]/a[.//img[contains(@src, "back")]]'
2013-04-10 16:36:33 +00:00
help = 'Index format: nnn'
2019-06-30 00:10:37 +00:00
class AHClub(_WPNaviIn):
baseUrl = 'http://rickgriffinstudios.com/'
url = baseUrl + 'ah-club/'
stripUrl = baseUrl + 'comic-post/%s/'
firstStripUrl = stripUrl % 'cover'
latestSearch = '//a[contains(@title, "Permanent Link")]'
starter = indirectStarter
nav = {
'ah-club-2-cover': 'ah-club-1-page-24',
'ah-club-3-cover': 'ah-club-2-page-28',
'ah-club-4-cover': 'ah-club-3-page-22'
}
def getPrevUrl(self, url, data):
# Links between chapters
url = url.rstrip('/').rsplit('/', 1)[-1]
if self.nav and url in self.nav:
return self.stripUrl % self.nav[url]
return super(AHClub, self).getPrevUrl(url, data)
class AhoiPolloi(_ParserScraper):
2016-04-07 21:21:31 +00:00
url = 'https://ahoipolloi.blogger.de/'
2013-03-07 22:51:55 +00:00
stripUrl = url + '?day=%s'
firstStripUrl = stripUrl % '20060306'
2013-03-07 22:51:55 +00:00
multipleImagesPerStrip = True
2013-03-08 21:33:05 +00:00
lang = 'de'
imageSearch = '//img[contains(@src, "/static/antville/ahoipolloi/")]'
prevSearch = '//a[contains(@href, "/?day=")]'
2013-03-07 22:51:55 +00:00
help = 'Index format: yyyymmdd'
2017-05-21 23:17:05 +00:00
class AhoyEarth(_WPNavi):
url = 'http://www.ahoyearth.com/'
2016-04-07 21:21:31 +00:00
class AirForceBlues(_WordPressScraper):
url = 'http://farvatoons.com/'
firstStripUrl = url + 'comic/in-texas-there-are-texans/'
2013-04-10 16:36:33 +00:00
2013-03-06 19:21:10 +00:00
class ALessonIsLearned(_BasicScraper):
url = 'http://www.alessonislearned.com/'
prevSearch = compile(tagre("a", "href", r"(index\.php\?comic=\d+)",
quote="'") + r"[^>]+previous")
2013-03-06 19:21:10 +00:00
stripUrl = url + 'index.php?comic=%s'
firstStripUrl = stripUrl % '1'
2013-03-06 19:21:10 +00:00
imageSearch = compile(tagre("img", "src", r"(cmx/lesson\d+\.[a-z]+)"))
help = 'Index format: nnn'
2016-09-28 23:29:01 +00:00
class Alice(_WordPressScraper):
url = 'http://www.alicecomics.com/'
latestSearch = '//a[text()="Latest Alice!"]'
starter = indirectStarter
2019-07-09 06:11:49 +00:00
class AlienDice(_WordPressScraper):
url = 'http://aliendice.com/'
stripUrl = url + 'comic/%s/'
firstStripUrl = stripUrl % '05162001'
def getPrevUrl(self, url, data):
# Fix broken navigation
if url == self.stripUrl % 'day-29-part-2-page-3-4':
return self.stripUrl % 'day-29-part-2-page-3-2'
return super(AlienDice, self).getPrevUrl(url, data)
def namer(self, imageUrl, pageUrl):
# Fix inconsistent filename
return imageUrl.rsplit('/', 1)[-1].replace('20010831', '2001-08-31')
class AlienDiceLegacy(_WordPressScraper):
name = 'AlienDice/Legacy'
stripUrl = 'http://aliendice.com/comic/%s/'
url = stripUrl % 'legacy-2-15'
firstStripUrl = stripUrl % 'legacy-1'
2012-06-20 19:58:13 +00:00
class AlienLovesPredator(_BasicScraper):
url = 'http://alienlovespredator.com/'
stripUrl = url + '%s/'
firstStripUrl = stripUrl % '2004/10/12/unavoidable-delay'
imageSearch = compile(tagre("img", "src", r'([^"]+)',
after='border="1" alt="" width="750"'))
prevSearch = compile(tagre("a", "href", r'([^"]+)', after="prev"))
help = 'Index format: yyyy/mm/dd/name'
2012-06-20 19:58:13 +00:00
2016-04-07 21:21:31 +00:00
class AlienShores(_WordPressScraper):
url = 'http://alienshores.com/alienshores_band/'
firstStripUrl = url + 'AScomic/updated-cover/'
2013-04-10 16:36:33 +00:00
class AllTheGrowingThings(_BasicScraper):
url = 'http://growingthings.typodmary.com/'
rurl = escape(url)
stripUrl = url + '%s/'
firstStripUrl = stripUrl % '2009/04/21/all-the-growing-things'
2013-11-12 17:33:14 +00:00
imageSearch = compile(tagre("img", "src", r'(%sfiles/[^"]+)' % rurl))
2013-04-10 16:36:33 +00:00
prevSearch = compile(tagre("a", "href", r'(%s[^"]+)' % rurl, after="prev"))
help = 'Index format: yyyy/mm/dd/strip-name'
2019-06-24 05:24:20 +00:00
class AlphaLuna(_ParserScraper):
url = 'https://alphaluna.net/'
stripUrl = url + 'comic/%s/'
firstStripUrl = stripUrl % 'issue-1-cover'
imageSearch = '//main[@id="comic"]//img'
prevSearch = '//a[@rel="prev"]'
class AlphaLunaSpanish(_ParserScraper):
2013-02-20 22:34:55 +00:00
name = 'AlphaLuna/Spanish'
2013-03-08 21:33:05 +00:00
lang = 'es'
2019-06-24 05:24:20 +00:00
url = 'https://alphaluna.net/spanish/'
stripUrl = url + 'comic/%s/'
firstStripUrl = stripUrl % 'issue-1-cover'
imageSearch = '//main[@id="comic"]//img'
prevSearch = '//a[@rel="prev"]'
2013-02-20 22:34:55 +00:00
2019-06-24 05:28:30 +00:00
class Altermeta(_ParserScraper):
url = 'http://altermeta.net/'
stripUrl = url + 'archive.php?comic=%s'
firstStripUrl = stripUrl % '0'
2019-06-24 05:28:30 +00:00
imageSearch = '//img[contains(@src, "comics/")]'
prevSearch = '//a[./img[contains(@src, "back")]]'
nextSearch = '//a[./img[contains(@src, "forward")]]'
starter = bounceStarter
2012-06-20 19:58:13 +00:00
help = 'Index format: n (unpadded)'
2019-06-24 05:28:30 +00:00
def namer(self, imageUrl, pageUrl):
return pageUrl.rsplit('=', 1)[-1] + '_' + imageUrl.rsplit('/', 1)[-1]
2012-06-20 19:58:13 +00:00
class AltermetaOld(Altermeta):
2013-04-10 21:57:09 +00:00
url = Altermeta.url + 'oldarchive/index.php'
stripUrl = Altermeta.url + 'oldarchive/archive.php?comic=%s'
firstStripUrl = stripUrl % '0'
2012-06-20 19:58:13 +00:00
prevSearch = compile(r'<a href="([^"]+)">Back')
2012-12-28 04:41:26 +00:00
class AmazingSuperPowers(_BasicScraper):
url = 'http://www.amazingsuperpowers.com/'
rurl = escape(url)
stripUrl = url + '%s/'
firstStripUrl = stripUrl % '2007/09/heredity'
imageSearch = compile(tagre("img", "src", r'(%scomics/[^"]+)' % rurl))
prevSearch = compile(tagre("a", "href", r'(%s[^"]+)' % rurl, after="prev"))
2012-12-28 04:41:26 +00:00
help = 'Index format: yyyy/mm/name'
def shouldSkipUrl(self, url, data):
2013-05-25 21:24:33 +00:00
"""Skip pages without images."""
return url in (
# video
self.stripUrl % '2013/05/orbital-deathray-kickstarter',
)
2012-12-28 04:41:26 +00:00
class Amya(_WordPressScraper):
url = 'http://www.amyachronicles.com/'
2019-07-06 04:47:16 +00:00
class Anaria(_ParserScraper):
url = 'https://www.leahbriere.com/anaria-the-witchs-dream/'
firstStripUrl = url
imageSearch = '//div[contains(@class, "gallery")]//a'
multipleImagesPerStrip = True
endOfLife = True
def namer(self, imageUrl, pageUrl):
filename = imageUrl.rsplit('/', 1)[-1]
return filename.replace('00.jpg', 'new00.jpg').replace('new', '1')
2013-04-10 16:36:33 +00:00
class Angband(_BasicScraper):
url = 'http://angband.calamarain.net/'
stripUrl = url + 'view.php?date=%s'
firstStripUrl = stripUrl % '2005-12-30'
imageSearch = compile(tagre("img", "src", r'(comics/Scroll[^"]+)'))
prevSearch = compile(tagre("a", "href", r'(view\.php\?date\=[^"]+)') +
"Previous")
2013-04-10 16:36:33 +00:00
help = 'Index format: yyyy-mm-dd'
2012-06-20 19:58:13 +00:00
class Angels2200(_BasicScraper):
url = 'http://www.janahoffmann.com/angels/'
stripUrl = url + '%s'
2012-12-02 17:35:06 +00:00
imageSearch = compile(tagre("img", "src", r"(http://www\.janahoffmann\.com/angels/comics/[^']+)", quote="'"))
prevSearch = compile(tagre("a", "href", r'([^"]+)') + "&laquo; Previous")
2012-11-14 05:22:08 +00:00
help = 'Index format: yyyy/mm/dd/part-<n>-comic-<n>'
2012-06-20 19:58:13 +00:00
2016-04-07 21:21:31 +00:00
class Annyseed(_ParserScraper):
baseUrl = 'http://www.mirrorwoodcomics.com/'
url = baseUrl + 'AnnyseedLatest.htm'
stripUrl = baseUrl + 'Annyseed%s.htm'
imageSearch = '//div/img[contains(@src, "Annyseed")]'
prevSearch = '//a[img[@name="Previousbtn"]]'
2013-04-10 16:36:33 +00:00
help = 'Index format: nnn'
2017-02-05 23:05:05 +00:00
FIX_RE = compile(r'Annyseed/Finished%20For%20Print/')
def imageUrlModifier(self, image_url, data):
return self.FIX_RE.sub('', image_url)
2013-04-10 16:36:33 +00:00
def link_modifier(self, fromurl, tourl):
"""Fix circular link."""
if 'Annyseed150' in fromurl and 'Annyseed150' in tourl:
return self.stripUrl % '149'
return tourl
2013-04-10 16:36:33 +00:00
2018-05-22 22:54:40 +00:00
2019-06-24 04:15:09 +00:00
class ApartmentForTwo(_ParserScraper):
url = 'http://www.apartmentfor2.com/'
stripUrl = url + 'index.php?date=%s'
firstStripUrl = url + 'comics/'
imageSearch = '//a/img[contains(@src, "comics/")]'
prevSearch = '//a[./img[contains(@src, "previous")]]'
help = 'Index format: yyyymmdd'
2012-06-20 19:58:13 +00:00
class AppleGeeks(_BasicScraper):
url = 'http://www.applegeeks.com/'
stripUrl = url + 'comics/viewcomic.php?issue=%s'
firstStripUrl = stripUrl % '1'
2012-12-02 17:35:06 +00:00
imageSearch = compile(tagre("img", "src", r'((?:/comics/)?issue\d+\.jpg)'))
2012-06-20 19:58:13 +00:00
prevSearch = compile(r'<div class="caption">Previous Comic</div>\s*<p><a href="([^"]+)">', MULTILINE)
allow_errors = (404,)
2012-06-20 19:58:13 +00:00
help = 'Index format: n (unpadded)'
2013-04-25 18:37:27 +00:00
class ARedTailsDream(_BasicScraper):
baseUrl = 'http://www.minnasundberg.fi/'
stripUrl = baseUrl + 'comic/page%s.php'
firstStripUrl = stripUrl % '00'
url = baseUrl + 'comic/recent.php'
imageSearch = compile(tagre('img', 'src', r'(chapter.+?/eng[^"]*)'))
prevSearch = compile(tagre('a', 'href', r'(page\d+\.php)') +
tagre("img", "src", r'.*?aprev.*?'))
2013-04-25 18:37:27 +00:00
help = 'Index format: nn'
class Ashes(_WordPressScraper):
url = 'http://www.flowerlarkstudios.com/comicpage/prologue/10232009/'
firstStripUrl = url
latestSearch = WP_LATEST_SEARCH
starter = indirectStarter
2016-04-07 21:21:31 +00:00
class AstronomyPOTD(_ParserScraper):
baseUrl = 'http://apod.nasa.gov/apod/'
2013-04-13 18:58:00 +00:00
url = baseUrl + 'astropix.html'
starter = bounceStarter
2013-04-13 18:58:00 +00:00
stripUrl = baseUrl + 'ap%s.html'
firstStripUrl = stripUrl % '061012'
2016-04-07 21:21:31 +00:00
imageSearch = '//a/img'
2012-12-07 23:45:18 +00:00
multipleImagesPerStrip = True
2016-04-07 21:21:31 +00:00
prevSearch = '//a[text()="<"]'
nextSearch = '//a[text()=">"]'
2012-06-20 19:58:13 +00:00
help = 'Index format: yymmdd'
def shouldSkipUrl(self, url, data):
"""Skip pages without images."""
2016-04-07 21:21:31 +00:00
return data.xpath('//iframe') # videos
def namer(self, image_url, page_url):
2016-04-07 21:21:31 +00:00
return '%s-%s' % (page_url.split('/')[-1].split('.')[0][2:],
image_url.split('/')[-1].split('.')[0])
2019-06-20 05:00:34 +00:00
class ATaleOfTails(_WordPressScraper):
url = 'http://www.feretta.net/'
stripUrl = url + 'comic/%s/'
firstStripUrl = stripUrl % 'a-tale-of-tails-1-0'
adult = True
class AxeCop(_WordPressScraper):
url = 'http://axecop.com/comic/season-two/'