Code Duplication    Length = 29-30 lines in 2 locations

comics.py 2 locations

@@ 3476-3505 (lines=30) @@
3473
        }
3474
3475
3476
class MarketoonistComics(GenericNavigableComic):
3477
    """Class to retrieve Marketoonist Comics."""
3478
    name = 'marketoonist'
3479
    long_name = 'Marketoonist'
3480
    url = 'https://marketoonist.com/cartoons'
3481
    get_first_comic_link = simulate_first_link
3482
    get_navi_link = get_link_rel_next
3483
    first_url = 'https://marketoonist.com/2002/10/the-8-types-of-brand-managers-2.html'
3484
3485
    @classmethod
3486
    def get_comic_info(cls, soup, link):
3487
        """Get information about a particular comics."""
3488
        imgs = soup.find_all('meta', property='og:image')
3489
        date_str = soup.find('meta', property='article:published_time')['content'][:10]
3490
        day = string_to_date(date_str, "%Y-%m-%d")
3491
        title = soup.find('meta', property='og:title')['content']
3492
        return {
3493
            'img': [i['content'] for i in imgs],
3494
            'day': day.day,
3495
            'month': day.month,
3496
            'year': day.year,
3497
            'title': title,
3498
        }
3499
3500
3501
class ConsoliaComics(GenericNavigableComic):
3502
    """Class to retrieve Consolia comics."""
3503
    name = 'consolia'
3504
    long_name = 'consolia'
3505
    url = 'https://consolia-comic.com'
3506
    get_url_from_link = join_cls_url_to_href
3507
3508
    @classmethod
@@ 3323-3351 (lines=29) @@
3320
3321
class EarthExplodes(GenericNavigableComic):
3322
    """Class to retrieve The Earth Explodes comics."""
3323
    name = 'earthexplodes'
3324
    long_name = 'The Earth Explodes'
3325
    url = 'http://www.earthexplodes.com'
3326
    get_url_from_link = join_cls_url_to_href
3327
    get_first_comic_link = simulate_first_link
3328
    first_url = 'http://www.earthexplodes.com/comics/000/'
3329
3330
    @classmethod
3331
    def get_navi_link(cls, last_soup, next_):
3332
        """Get link to next or previous comic."""
3333
        return last_soup.find('a', id='next' if next_ else 'prev')
3334
3335
    @classmethod
3336
    def get_comic_info(cls, soup, link):
3337
        """Get information about a particular comics."""
3338
        title = soup.find('title').string
3339
        imgs = soup.find('div', id='image').find_all('img')
3340
        alt = imgs[0].get('title', '')
3341
        return {
3342
            'img': [urljoin_wrapper(cls.url, i['src']) for i in imgs],
3343
            'title': title,
3344
            'alt': alt,
3345
        }
3346
3347
3348
class PomComics(GenericNavigableComic):
3349
    """Class to retrieve PomComics."""
3350
    name = 'pom'
3351
    long_name = 'Pom Comics / Piece of Me'
3352
    url = 'http://www.pomcomic.com'
3353
    get_url_from_link = join_cls_url_to_href
3354