Code Duplication    Length = 29-30 lines in 2 locations

comics.py 2 locations

@@ 3448-3477 (lines=30) @@
3445
        }
3446
3447
3448
class ConsoliaComics(GenericNavigableComic):
3449
    """Class to retrieve Consolia comics."""
3450
    name = 'consolia'
3451
    long_name = 'consolia'
3452
    url = 'https://consolia-comic.com'
3453
    get_url_from_link = join_cls_url_to_href
3454
3455
    @classmethod
3456
    def get_first_comic_link(cls):
3457
        """Get link to first comics."""
3458
        return get_soup_at_url(cls.url).find('a', class_='first')
3459
3460
    @classmethod
3461
    def get_navi_link(cls, last_soup, next_):
3462
        """Get link to next or previous comic."""
3463
        return last_soup.find('a', class_='next' if next_ else 'prev')
3464
3465
    @classmethod
3466
    def get_comic_info(cls, soup, link):
3467
        """Get information about a particular comics."""
3468
        title = soup.find('meta', property='og:title')['content']
3469
        date_str = soup.find('time')["datetime"]
3470
        day = string_to_date(date_str, "%Y-%m-%d")
3471
        imgs = soup.find_all('meta', property='og:image')
3472
        return {
3473
            'title': title,
3474
            'img': [i['content'] for i in imgs],
3475
            'day': day.day,
3476
            'month': day.month,
3477
            'year': day.year,
3478
        }
3479
3480
@@ 3294-3322 (lines=29) @@
3291
        }
3292
3293
3294
class PomComics(GenericNavigableComic):
3295
    """Class to retrieve PomComics."""
3296
    name = 'pom'
3297
    long_name = 'Pom Comics / Piece of Me'
3298
    url = 'http://www.pomcomic.com'
3299
    get_url_from_link = join_cls_url_to_href
3300
3301
    @classmethod
3302
    def get_first_comic_link(cls):
3303
        """Get link to first comics."""
3304
        return get_soup_at_url(cls.url).find('a', class_='btn-first')
3305
3306
    @classmethod
3307
    def get_navi_link(cls, last_soup, next_):
3308
        """Get link to next or previous comic."""
3309
        return last_soup.find('a', class_='btn-next' if next_ else 'btn-prev')
3310
3311
    @classmethod
3312
    def get_comic_info(cls, soup, link):
3313
        """Get information about a particular comics."""
3314
        title = soup.find('h1').string
3315
        desc = soup.find('meta', property='og:description')['content']
3316
        tags = soup.find('meta', attrs={'name': 'keywords'})['content']
3317
        imgs = soup.find('div', class_='comic').find_all('img')
3318
        return {
3319
            'title': title,
3320
            'desc': desc,
3321
            'tags': tags,
3322
            'img': [urljoin_wrapper(cls.url, i['src']) for i in imgs],
3323
        }
3324
3325