Fix Nightshift and StarfireAgency
This commit is contained in:
parent
2688ffad91
commit
2ef6ebb6f8
2 changed files with 37 additions and 35 deletions
|
@ -102,31 +102,29 @@ class Nicky510(_WPNavi):
|
||||||
endOfLife = True
|
endOfLife = True
|
||||||
|
|
||||||
|
|
||||||
class Nightshift(_ParserScraper):
|
class Nightshift(_WPWebcomic):
|
||||||
url = 'https://poecatcomix.com/nightshift-static/'
|
url = 'https://poecatcomix.com/nightshift-static/'
|
||||||
stripUrl = 'https://poecatcomix.com/comic/%s/'
|
stripUrl = 'https://poecatcomix.com/nightshift/%s/'
|
||||||
firstStripUrl = stripUrl % 'ns1-page-cover'
|
firstStripUrl = stripUrl % 'ns-cover'
|
||||||
imageSearch = '//div[@class="mangapress-media-img"]/img'
|
imageSearch = '//div[contains(@class, "webcomic-media")]//img'
|
||||||
prevSearch = '//li[@class="link-prev"]/a'
|
|
||||||
latestSearch = '//li[@class="link-last"]/a/@href'
|
|
||||||
adult = True
|
adult = True
|
||||||
|
|
||||||
def starter(self):
|
def starter(self):
|
||||||
# Build list of chapters for navigation
|
# Build list of chapters for naming
|
||||||
indexPage = self.getPage(self.url)
|
indexPage = self.getPage(self.url)
|
||||||
self.chapters = indexPage.xpath('//a[./img[contains(@class, "attachment-large")]]/@href')
|
self.chapters = indexPage.xpath('//a[./img[contains(@class, "attachment-large")]]/@href')
|
||||||
chapterPage = self.getPage(self.chapters[-1])
|
latestPage = self.chapters[0]
|
||||||
return chapterPage.xpath(self.latestSearch)[0]
|
self.chapters = self.chapters[1:]
|
||||||
|
self.currentChapter = len(self.chapters)
|
||||||
def getPrevUrl(self, url, data):
|
return latestPage
|
||||||
# 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)
|
|
||||||
|
|
||||||
def namer(self, imageUrl, pageUrl):
|
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):
|
class Nimona(_ParserScraper):
|
||||||
|
|
|
@ -500,26 +500,30 @@ class StarCrossdDestiny(_ParserScraper):
|
||||||
return directory + '-' + filename
|
return directory + '-' + filename
|
||||||
|
|
||||||
|
|
||||||
class StarfireAgency(_WordPressScraper):
|
class StarfireAgency(_WPWebcomic):
|
||||||
url = 'http://starfire.poecatcomix.com/'
|
url = 'https://poecatcomix.com/starfire-agency-static/'
|
||||||
stripUrl = url + 'comic/%s/'
|
stripUrl = 'https://poecatcomix.com/starfire-agency/%s/'
|
||||||
firstStripUrl = stripUrl % 'sfa-issue-1'
|
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):
|
def namer(self, imageUrl, pageUrl):
|
||||||
# Prepend chapter title to page filenames
|
page = pageUrl.rstrip('/').rsplit('/', 1)[-1]
|
||||||
page = self.getPage(pageUrl)
|
page = page.replace('3page00', 'cover3').replace('6429', 'cover7').replace('sfa-6-5-cover', 'cover6')
|
||||||
chapter = page.xpath('//div[@class="comic-chapter"]/a')
|
page = page.replace('sfa01', 'page01').replace('sfa03', 'page03').replace('sfa04', 'page04')
|
||||||
if len(chapter) > 0:
|
page = page.replace('sfa24', 'page24').replace('sfa07', 'page')
|
||||||
chapter = chapter[0].text.replace(' ', '-').lower()
|
filename = 'sfa%d-%s.%s' % (self.currentChapter, page, imageUrl.rsplit('.', 1)[-1])
|
||||||
else:
|
if pageUrl in self.chapters:
|
||||||
chapter = 'chapter-1'
|
self.currentChapter = self.currentChapter - 1
|
||||||
|
return filename
|
||||||
# Fix inconsistent filenames
|
|
||||||
filename = imageUrl.rsplit('/', 1)[-1]
|
|
||||||
if 'cover' not in filename.lower():
|
|
||||||
filename = filename.replace('SFA', 'Page')
|
|
||||||
return chapter + '_' + filename
|
|
||||||
|
|
||||||
|
|
||||||
class StarTrip(_ComicControlScraper):
|
class StarTrip(_ComicControlScraper):
|
||||||
url = 'https://www.startripcomic.com/'
|
url = 'https://www.startripcomic.com/'
|
||||||
|
|
Loading…
Reference in a new issue