dosage/dosagelib/plugins/l.py

211 lines
7.1 KiB
Python
Raw Normal View History

# SPDX-License-Identifier: MIT
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
# Copyright (C) 2015-2021 Tobias Gruetzmacher
# Copyright (C) 2019-2020 Daniel Ring
2019-09-08 02:03:01 +00:00
from re import compile
from ..scraper import _BasicScraper, _ParserScraper
2019-07-14 09:09:20 +00:00
from ..helpers import bounceStarter, indirectStarter
2012-11-21 20:57:26 +00:00
from ..util import tagre
from .common import _ComicControlScraper, _WordPressScraper, _WPNaviIn
2012-06-20 19:58:13 +00:00
2019-06-28 04:48:07 +00:00
class Lackadaisy(_ParserScraper):
url = 'https://www.lackadaisy.com/comic.php'
stripUrl = url + '?comicid=%s'
2013-04-25 19:06:12 +00:00
firstStripUrl = stripUrl % '1'
2019-06-28 04:48:07 +00:00
imageSearch = '//div[@id="content"]/img'
prevSearch = '//div[@class="prev"]/a'
nextSearch = '//div[@class="next"]/a'
2013-04-25 19:06:12 +00:00
help = 'Index format: n'
starter = bounceStarter
2013-04-25 19:06:12 +00:00
2019-06-28 04:48:07 +00:00
def namer(self, imageUrl, pageUrl):
# Use comic id for filename
num = pageUrl.rsplit('=', 1)[-1]
ext = imageUrl.rsplit('.', 1)[-1]
2013-04-25 19:06:12 +00:00
return 'lackadaisy_%s.%s' % (num, ext)
2019-06-23 09:10:24 +00:00
class LastResort(_WordPressScraper):
url = 'http://www.lastres0rt.com/'
stripUrl = url + 'comic/%s/'
firstStripUrl = stripUrl % 'that-sound-you-hear-is-a-shattered-stereotype'
2020-04-16 09:03:04 +00:00
class LazJonesAndTheMayfieldRegulators(_ParserScraper):
baseUrl = 'https://www.lazjones.com/'
url = baseUrl + 'regulators'
stripUrl = baseUrl + 'comic/%s'
2020-04-16 09:03:04 +00:00
firstStripUrl = stripUrl % 'chapter1_00'
imageSearch = '//img[contains(@src, "comic/pages/")]'
prevSearch = '//a[contains(text(), "Previous")]'
class LazJonesAndTheMayfieldRegulatorsSideStories(LazJonesAndTheMayfieldRegulators):
name = 'LazJonesAndTheMayfieldRegulators/SideStories'
baseUrl = 'https://www.lazjones.com/'
2021-01-30 09:58:16 +00:00
url = baseUrl + 'comics'
stripUrl = baseUrl + 'comic/%s'
firstStripUrl = stripUrl % 'journal01'
2021-01-30 09:58:16 +00:00
def getPrevUrl(self, url, data):
# Fix broken navigation links
if url == self.url and data.xpath(self.prevSearch + '/@href')[0] == self.stripUrl % 'summer00':
return self.stripUrl % 'summer21'
return super(LazJonesAndTheMayfieldRegulators, self).getPrevUrl(url, data)
2017-12-14 23:00:25 +00:00
class LeastICouldDo(_ParserScraper):
url = 'https://leasticoulddo.com/'
2013-03-06 19:21:10 +00:00
stripUrl = url + 'comic/%s'
2017-12-14 23:00:25 +00:00
firstStripUrl = stripUrl % '20030210'
imageSearch = '//div[@id="content-comic"]//img'
prevSearch = '//a[@rel="prev"]'
latestSearch = '//a[@id="latest-comic"]'
starter = indirectStarter
2013-03-06 19:21:10 +00:00
help = 'Index format: yyyymmdd'
class LetsSpeakEnglish(_ComicControlScraper):
url = 'http://www.marycagle.com'
2018-04-21 00:25:11 +00:00
class LifeAintNoPonyFarm(_WordPressScraper):
url = ('https://web.archive.org/web/20181221154155/'
'http://sarahburrini.com/en/')
2018-04-21 00:25:11 +00:00
firstStripUrl = url + 'comic/my-first-webcomic/'
multipleImagesPerStrip = True
endOfLife = True
2018-04-21 00:25:11 +00:00
2019-06-28 04:43:37 +00:00
class LifeAsRendered(_ParserScraper):
# Reverse navigation doesn't work properly, so search forward instead
stripUrl = 'https://kittyredden.com/LAR/%s/'
url = stripUrl % '0100'
firstStripUrl = stripUrl % '05extra'
imageSearch = '//figure[@class="wp-block-image"]//img'
prevSearch = '//a[img[@alt="Next"]]'
textSearch = '//div[@class="entry-content"]//text()'
adult = True
endOfLife = True
nav = {
'0140': '0200',
'0272': '02ss00',
'02SS14': '0300',
'0367': '03ss00',
'03ss10': '0400',
'0408': '0409',
'0409': '0410',
'0421': '0422',
'0449': '0450',
'0458': '0460',
'0460': '04ss00',
'04ss00': '04ss01',
'04ss10': '0500',
'0500': '0501',
'0508': '0509',
'0558': '0559',
'0577': '05extra',
2019-06-28 04:43:37 +00:00
}
def namer(self, imageUrl, pageUrl):
# Fix inconsistent filenames
filename = imageUrl.rsplit('/', 1)[-1]
return filename.replace('ReN', 'N').replace('N01P', 'A02S')
2019-06-28 04:43:37 +00:00
def fetchUrls(self, url, data, urlSearch):
# Fix missing image link
if 'LAR/0403' in url and urlSearch == self.imageSearch:
return [self.stripUrl.rstrip('/') % 'A04/A04P03.png']
return super(LifeAsRendered, self).fetchUrls(url, data, urlSearch)
def getPrevUrl(self, url, data):
# Fix broken navigation links
page = url.rstrip('/').rsplit('/', 1)[-1]
2020-06-21 06:10:40 +00:00
if page in self.nav:
2019-06-28 04:43:37 +00:00
return self.stripUrl % self.nav[page]
return super(LifeAsRendered, self).getPrevUrl(url, data)
def fetchText(self, url, data, textSearch, optional):
# Save final summary text
if url == self.firstStripUrl:
url = self.stripUrl % 'the-end'
data = self.getPage(url)
return super(LifeAsRendered, self).fetchText(url, data, textSearch, optional)
return None
2019-10-26 09:02:52 +00:00
class LilithsWord(_ComicControlScraper):
url = 'http://www.lilithword.com/'
stripUrl = url + 'comic/%s'
firstStripUrl = stripUrl % 'prologue-page-00'
def namer(self, imageUrl, pageUrl):
return imageUrl.rsplit('/', 1)[-1].split('-', 1)[1]
2013-03-06 19:21:10 +00:00
class LittleGamers(_BasicScraper):
url = 'http://www.little-gamers.com/'
stripUrl = url + '%s/'
2013-04-10 21:57:09 +00:00
firstStripUrl = stripUrl % '2000/12/01/99'
2013-03-06 19:21:10 +00:00
imageSearch = compile(tagre("img", "src", r'(http://little-gamers\.com/comics/[^"]+)'))
2013-03-26 16:36:06 +00:00
prevSearch = compile(tagre("a", "href", r'(http://www\.little-gamers\.com/[^"]+)', before="comic-nav-prev-link"))
2013-03-06 19:21:10 +00:00
help = 'Index format: yyyy/mm/dd/name'
2019-07-06 18:23:09 +00:00
class LittleTales(_ParserScraper):
url = 'http://www.little-tales.com/'
stripUrl = url + 'index.php?Strip=%s'
firstStripUrl = stripUrl % '1'
url = stripUrl % '450'
imageSearch = '//img[contains(@src, "strips/")]'
prevSearch = '//a[./img[@alt="BACK"]]'
nextSearch = '//a[./img[@alt="FORWARD"]]'
starter = bounceStarter
nav = {
'517': '515',
'449': '447',
2019-07-06 18:23:09 +00:00
}
def namer(self, imageUrl, pageUrl):
page = pageUrl.rsplit('=', 1)[-1]
ext = imageUrl.rsplit('.', 1)[-1]
return page + '.' + ext
def getPrevUrl(self, url, data):
# Skip missing pages with broken navigation links
page = url.rsplit('=', 1)[1]
if page in self.nav:
return self.stripUrl % self.nav[page]
return super(LittleTales, self).getPrevUrl(url, data)
2015-05-31 23:33:50 +00:00
class LoadingArtist(_ParserScraper):
2016-08-16 09:20:35 +00:00
url = 'http://www.loadingartist.com/latest'
2015-05-31 23:33:50 +00:00
imageSearch = '//div[@class="comic"]//img'
prevSearch = "//a[contains(concat(' ', @class, ' '), ' prev ')]"
class LoFiJinks(_WPNaviIn):
baseUrl = 'https://hijinksensue.com/comic/'
url = baseUrl + 'learning-to-love-again/'
firstStripUrl = baseUrl + 'lo-fijinks-everything-i-know-anout-james-camerons-avatar-movie/'
endOfLife = True
class LookingForGroup(_ParserScraper):
2019-07-14 09:09:20 +00:00
url = 'https://www.lfg.co/'
stripUrl = url + 'page/%s/'
2013-04-10 21:57:09 +00:00
firstStripUrl = stripUrl % '1'
imageSearch = '//div[@id="comic-img"]//img'
2019-07-14 09:09:20 +00:00
prevSearch = '//a[@class="comic-nav-prev"]'
latestSearch = '//div[@id="feature-lfg-footer"]/a[contains(@href, "page/")]'
starter = indirectStarter
2012-06-20 19:58:13 +00:00
help = 'Index format: nnn'
2019-07-14 09:09:20 +00:00
def namer(self, imageUrl, pageUrl):
page = pageUrl.rstrip('/').rsplit('/', 1)[-1]
return page.replace('2967', '647')