dosage/dosagelib/plugins/l.py

199 lines
6.6 KiB
Python
Raw Normal View History

# SPDX-License-Identifier: MIT
# SPDX-FileCopyrightText: © 2004 Tristan Seligmann and Jonathan Jacobs
# SPDX-FileCopyrightText: © 2012 Bastian Kleineidam
# SPDX-FileCopyrightText: © 2015 Tobias Gruetzmacher
# SPDX-FileCopyrightText: © 2019 Daniel Ring
2023-08-27 00:23:16 +00:00
from ..scraper import ParserScraper, _ParserScraper
2019-07-14 09:09:20 +00:00
from ..helpers import bounceStarter, indirectStarter
2024-02-14 22:51:30 +00:00
from .common import ComicControlScraper, WordPressScraper
2013-04-25 19:06:12 +00:00
2023-04-11 07:10:11 +00:00
class Lancer(WordPressScraper):
url = 'https://lancercomic.com/'
stripUrl = url + 'comic/%s/'
firstStripUrl = stripUrl % 'chapter-1-cover'
class LastResort(WordPressScraper):
2019-06-23 09:10:24 +00:00
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
2024-03-17 20:44:46 +00:00
if url == self.url and self.match(data, self.prevSearch + '/@href')[0] == self.stripUrl % 'summer00':
2021-01-30 09:58:16 +00:00
return self.stripUrl % 'summer21'
return super(LazJonesAndTheMayfieldRegulators, self).getPrevUrl(url, data)
2022-12-27 22:06:27 +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 = '//img[d:class("comic")]'
2017-12-14 23:00:25 +00:00
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'
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
class LifeAsRendered(ParserScraper):
2019-06-28 04:43:37 +00:00
# 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 extract_image_urls(self, url, data):
2019-06-28 04:43:37 +00:00
# Fix missing image link
if 'LAR/0403' in url:
2019-06-28 04:43:37 +00:00
return [self.stripUrl.rstrip('/') % 'A04/A04P03.png']
return super().extract_image_urls(url, data)
2019-06-28 04:43:37 +00:00
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
class LilithsWord(ComicControlScraper):
2019-10-26 09:02:52 +00:00
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]
2023-08-27 00:23:16 +00:00
class LittleGamers(ParserScraper):
url = 'https://www.little-gamers.com/'
firstStripUrl = url + '2000/12/01/99'
imageSearch = '//div[d:class("comic")]//img'
prevSearch = ('//a[@id="previous"]',
'//div[d:class("comic-navigation")]//a[text()="previous"]')
2013-03-06 19:21:10 +00:00
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):
2022-06-06 11:34:27 +00:00
url = 'https://loadingartist.com/'
firstStripUrl = url + 'comic/born/'
imageSearch = '//div[d:class("main-image-container")]//img'
prevSearch = '//div[d:class("left-nav")]//a'
latestSearch = '//nav//a[text()="Comic"]'
starter = indirectStarter
2023-08-27 00:23:16 +00:00
class LoFiJinks(WordPressScraper):
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
2022-12-27 22:10:34 +00:00
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'
2022-12-27 22:10:34 +00:00
prevSearch = '//a[d:class("comic-nav-prev")]'
2019-07-14 09:09:20 +00:00
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')