From 1ebdea7aaebaa29ea62f3cfbadc76dea8e1b6d77 Mon Sep 17 00:00:00 2001 From: Techwolf Date: Fri, 12 Mar 2021 22:11:03 -0800 Subject: [PATCH] Fix SMBC --- dosagelib/plugins/s.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/dosagelib/plugins/s.py b/dosagelib/plugins/s.py index 4668c5ef6..e6e07e6b5 100644 --- a/dosagelib/plugins/s.py +++ b/dosagelib/plugins/s.py @@ -312,15 +312,21 @@ class SluggyFreelance(_ParserScraper): class SMBC(_ComicControlScraper): - url = 'http://www.smbc-comics.com/' - firstStripUrl = url + 'comic/2002-09-05' - multipleImagesPerStrip = True + url = 'https://www.smbc-comics.com/' + stripUrl = url + 'comic/%s' + firstStripUrl = stripUrl % '2002-09-05' imageSearch = ['//img[@id="cc-comic"]', '//div[@id="aftercomic"]/img'] textSearch = '//img[@id="cc-comic"]/@title' + multipleImagesPerStrip = True - def namer(self, image_url, page_url): - """Remove random noise from name.""" - return image_url.rsplit('-', 1)[-1] + def namer(self, imageUrl, pageUrl): + # Remove random noise from filename + filename = imageUrl.rsplit('/', 1)[-1] + if '-' in filename and len(filename.rsplit('-', 1)[-1]) > 12: + filename = filename.rsplit('-', 1)[-1] + elif len(filename) > 22 and filename[0] == '1': + filename = filename[10:] + return filename class SnowFlame(_WordPressScraper):