Code Duplication    Length = 24-24 lines in 2 locations

comics.py 2 locations

@@ 3493-3516 (lines=24) @@
3490
    get_first_comic_link = simulate_first_link
3491
    first_url = 'http://geek-and-poke.com/geekandpoke/2006/8/27/a-new-place-for-a-not-so-old-blog.html'
3492
3493
    @classmethod
3494
    def get_navi_link(cls, last_soup, next_):
3495
        """Get link to next or previous comic."""
3496
        return last_soup.find('a', class_='prev-item' if next_ else 'next-item')
3497
3498
    @classmethod
3499
    def get_comic_info(cls, soup, link):
3500
        """Get information about a particular comics."""
3501
        title = soup.find('meta', property='og:title')['content']
3502
        desc = soup.find('meta', property='og:description')['content']
3503
        date_str = soup.find('time', class_='published')['datetime']
3504
        day = string_to_date(date_str, "%Y-%m-%d")
3505
        author = soup.find('a', rel='author').string
3506
        div_content = (soup.find('div', class_="body entry-content") or
3507
                       soup.find('div', class_="special-content"))
3508
        imgs = div_content.find_all('img')
3509
        imgs = [i for i in imgs if i.get('src') is not None]
3510
        assert all('title' not in i or i['alt'] == i['title'] for i in imgs)
3511
        alt = imgs[0].get('alt', "") if imgs else []
3512
        return {
3513
            'title': title,
3514
            'alt': alt,
3515
            'description': desc,
3516
            'author': author,
3517
            'day': day.day,
3518
            'month': day.month,
3519
            'year': day.year,
@@ 3426-3449 (lines=24) @@
3423
3424
class ConsoliaComics(GenericNavigableComic):
3425
    """Class to retrieve Consolia comics."""
3426
    name = 'consolia'
3427
    long_name = 'consolia'
3428
    url = 'https://consolia-comic.com'
3429
    get_url_from_link = join_cls_url_to_href
3430
3431
    @classmethod
3432
    def get_first_comic_link(cls):
3433
        """Get link to first comics."""
3434
        return get_soup_at_url(cls.url).find('a', class_='first')
3435
3436
    @classmethod
3437
    def get_navi_link(cls, last_soup, next_):
3438
        """Get link to next or previous comic."""
3439
        return last_soup.find('a', class_='next' if next_ else 'prev')
3440
3441
    @classmethod
3442
    def get_comic_info(cls, soup, link):
3443
        """Get information about a particular comics."""
3444
        title = soup.find('meta', property='og:title')['content']
3445
        date_str = soup.find('time')["datetime"]
3446
        day = string_to_date(date_str, "%Y-%m-%d")
3447
        imgs = soup.find_all('meta', property='og:image')
3448
        return {
3449
            'title': title,
3450
            'img': [i['content'] for i in imgs],
3451
            'day': day.day,
3452
            'month': day.month,