Code Duplication    Length = 29-30 lines in 2 locations

comics.py 2 locations

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