Skip to content

Commit

Permalink
PoorlyDrawnLines: Fix after site redesign
Browse files Browse the repository at this point in the history
  • Loading branch information
vemek committed Jul 1, 2024
1 parent df1e72e commit 2586aac
Showing 1 changed file with 27 additions and 4 deletions.
31 changes: 27 additions & 4 deletions dosagelib/plugins/p.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,13 +228,36 @@ def getPrevUrl(self, url, data):
prefix = url.rsplit('/', 1)[0]
return "%s/index%d.html" % (prefix, num)


class PoorlyDrawnLines(_ParserScraper):
url = 'http://poorlydrawnlines.com/comic/'
firstStripUrl = url + 'campus-characters/'
imageSearch = '//div[d:class("comic")]//img'
url = 'https://poorlydrawnlines.com/comic/'
stripUrl = url + '%s/'
multipleImagesPerStrip = True
firstStripUrl = stripUrl % 'hardly-essayists'
imageSearch = '//div[d:class("entry-content")]//img[@data-src]/@data-src'
prevSearch = '//a[@rel="prev"]'

def shouldSkipUrl(self, url, _data):
"""Skip pages without a comic."""
skipUrls = [self.stripUrl % s for s in (
'hope-it-all-works-out-new-book-coming-this-fall',
'poorly-drawn-lines-animated-series',
'poorly-drawn-lines-episode-two',
'watch-poorly-drawn-lines-on-hulu',
)]
return url in skipUrls

def getPrevUrl(self, url: str, data) -> str | None:
"""Skip missing comics which redirect back to home page"""
if url == self.stripUrl % '8198':
return self.stripUrl % 'excited-2'
elif url == self.stripUrl % '8186':
return self.stripUrl % 'to-hell-2'
elif url == self.stripUrl % '8177':
return self.stripUrl % 'feel-real'
elif url == self.stripUrl % '2056':
return self.stripUrl % 'stereotype'

return super().getPrevUrl(url, data)

class PoppyOPossum(WordPressScraper):
baseUrl = 'https://www.poppy-opossum.com/'
Expand Down

0 comments on commit 2586aac

Please sign in to comment.