Code Duplication    Length = 29-30 lines in 2 locations

comics.py 2 locations

@@ 3380-3409 (lines=30) @@
3377
3378
class MarketoonistComics(GenericNavigableComic):
3379
    """Class to retrieve Marketoonist Comics."""
3380
    name = 'marketoonist'
3381
    long_name = 'Marketoonist'
3382
    url = 'https://marketoonist.com/cartoons'
3383
    get_first_comic_link = simulate_first_link
3384
    get_navi_link = get_link_rel_next
3385
    first_url = 'https://marketoonist.com/2002/10/the-8-types-of-brand-managers-2.html'
3386
3387
    @classmethod
3388
    def get_comic_info(cls, soup, link):
3389
        """Get information about a particular comics."""
3390
        imgs = soup.find_all('meta', property='og:image')
3391
        date_str = soup.find('meta', property='article:published_time')['content'][:10]
3392
        day = string_to_date(date_str, "%Y-%m-%d")
3393
        title = soup.find('meta', property='og:title')['content']
3394
        return {
3395
            'img': [i['content'] for i in imgs],
3396
            'day': day.day,
3397
            'month': day.month,
3398
            'year': day.year,
3399
            'title': title,
3400
        }
3401
3402
3403
class ConsoliaComics(GenericNavigableComic):
3404
    """Class to retrieve Consolia comics."""
3405
    name = 'consolia'
3406
    long_name = 'consolia'
3407
    url = 'https://consolia-comic.com'
3408
    get_url_from_link = join_cls_url_to_href
3409
3410
    @classmethod
3411
    def get_first_comic_link(cls):
3412
        """Get link to first comics."""
@@ 3227-3255 (lines=29) @@
3224
    """Class to retrieve The Earth Explodes comics."""
3225
    name = 'earthexplodes'
3226
    long_name = 'The Earth Explodes'
3227
    url = 'http://www.earthexplodes.com'
3228
    get_url_from_link = join_cls_url_to_href
3229
    get_first_comic_link = simulate_first_link
3230
    first_url = 'http://www.earthexplodes.com/comics/000/'
3231
3232
    @classmethod
3233
    def get_navi_link(cls, last_soup, next_):
3234
        """Get link to next or previous comic."""
3235
        return last_soup.find('a', id='next' if next_ else 'prev')
3236
3237
    @classmethod
3238
    def get_comic_info(cls, soup, link):
3239
        """Get information about a particular comics."""
3240
        title = soup.find('title').string
3241
        imgs = soup.find('div', id='image').find_all('img')
3242
        alt = imgs[0].get('title', '')
3243
        return {
3244
            'img': [urljoin_wrapper(cls.url, i['src']) for i in imgs],
3245
            'title': title,
3246
            'alt': alt,
3247
        }
3248
3249
3250
class PomComics(GenericNavigableComic):
3251
    """Class to retrieve PomComics."""
3252
    name = 'pom'
3253
    long_name = 'Pom Comics / Piece of Me'
3254
    url = 'http://www.pomcomic.com'
3255
    get_url_from_link = join_cls_url_to_href
3256
3257
    @classmethod
3258
    def get_first_comic_link(cls):