Fix Nightshift and StarfireAgency

This commit is contained in:
Techwolf 2020-06-19 21:34:49 -07:00
parent 2688ffad91
commit 2ef6ebb6f8
2 changed files with 37 additions and 35 deletions

View file

@ -102,31 +102,29 @@ class Nicky510(_WPNavi):
endOfLife = True
class Nightshift(_ParserScraper):
class Nightshift(_WPWebcomic):
url = 'https://poecatcomix.com/nightshift-static/'
stripUrl = 'https://poecatcomix.com/comic/%s/'
firstStripUrl = stripUrl % 'ns1-page-cover'
imageSearch = '//div[@class="mangapress-media-img"]/img'
prevSearch = '//li[@class="link-prev"]/a'
latestSearch = '//li[@class="link-last"]/a/@href'
stripUrl = 'https://poecatcomix.com/nightshift/%s/'
firstStripUrl = stripUrl % 'ns-cover'
imageSearch = '//div[contains(@class, "webcomic-media")]//img'
adult = True
def starter(self):
# Build list of chapters for navigation
# Build list of chapters for naming
indexPage = self.getPage(self.url)
self.chapters = indexPage.xpath('//a[./img[contains(@class, "attachment-large")]]/@href')
chapterPage = self.getPage(self.chapters[-1])
return chapterPage.xpath(self.latestSearch)[0]
def getPrevUrl(self, url, data):
# Retrieve previous chapter from list
if url in self.chapters:
chapterPage = self.getPage(self.chapters[self.chapters.index(url) - 1])
return chapterPage.xpath(self.latestSearch)[0]
return super(Nightshift, self).getPrevUrl(url, data)
latestPage = self.chapters[0]
self.chapters = self.chapters[1:]
self.currentChapter = len(self.chapters)
return latestPage
def namer(self, imageUrl, pageUrl):
return pageUrl.rstrip('/').rsplit('/', 1)[-1] + '.' + imageUrl.rsplit('.', 1)[-1]
page = pageUrl.rstrip('/').rsplit('/', 1)[-1]
page = page.replace('blood-brothers', 'bloodbrothers').replace('bb-2', 'bb2').replace('ns7-', 'page-')
filename = 'ns%d-%s.%s' % (self.currentChapter, page, imageUrl.rsplit('.', 1)[-1])
if pageUrl in self.chapters:
self.currentChapter = self.currentChapter - 1
return filename
class Nimona(_ParserScraper):

View file

@ -500,26 +500,30 @@ class StarCrossdDestiny(_ParserScraper):
return directory + '-' + filename
class StarfireAgency(_WordPressScraper):
url = 'http://starfire.poecatcomix.com/'
stripUrl = url + 'comic/%s/'
firstStripUrl = stripUrl % 'sfa-issue-1'
class StarfireAgency(_WPWebcomic):
url = 'https://poecatcomix.com/starfire-agency-static/'
stripUrl = 'https://poecatcomix.com/starfire-agency/%s/'
firstStripUrl = stripUrl % '2005-09-201'
imageSearch = '//div[contains(@class, "webcomic-media")]//img'
def starter(self):
# Build list of chapters for naming
indexPage = self.getPage(self.url)
self.chapters = indexPage.xpath('//a[./img[contains(@class, "attachment-large")]]/@href')
latestPage = self.chapters[0]
self.chapters = self.chapters[1:]
self.currentChapter = len(self.chapters)
return latestPage
def namer(self, imageUrl, pageUrl):
# Prepend chapter title to page filenames
page = self.getPage(pageUrl)
chapter = page.xpath('//div[@class="comic-chapter"]/a')
if len(chapter) > 0:
chapter = chapter[0].text.replace(' ', '-').lower()
else:
chapter = 'chapter-1'
# Fix inconsistent filenames
filename = imageUrl.rsplit('/', 1)[-1]
if 'cover' not in filename.lower():
filename = filename.replace('SFA', 'Page')
return chapter + '_' + filename
page = pageUrl.rstrip('/').rsplit('/', 1)[-1]
page = page.replace('3page00', 'cover3').replace('6429', 'cover7').replace('sfa-6-5-cover', 'cover6')
page = page.replace('sfa01', 'page01').replace('sfa03', 'page03').replace('sfa04', 'page04')
page = page.replace('sfa24', 'page24').replace('sfa07', 'page')
filename = 'sfa%d-%s.%s' % (self.currentChapter, page, imageUrl.rsplit('.', 1)[-1])
if pageUrl in self.chapters:
self.currentChapter = self.currentChapter - 1
return filename
class StarTrip(_ComicControlScraper):
url = 'https://www.startripcomic.com/'