Code Duplication    Length = 18-18 lines in 2 locations

comics.py 2 locations

@@ 3555-3572 (lines=18) @@
3552
        date_str = soup.find('time', class_='published')['datetime']
3553
        day = string_to_date(date_str, "%Y-%m-%d")
3554
        author = soup.find('a', rel='author').string
3555
        div_content = (soup.find('div', class_="body entry-content") or
3556
                       soup.find('div', class_="special-content"))
3557
        imgs = div_content.find_all('img')
3558
        imgs = [i for i in imgs if i.get('src') is not None]
3559
        assert all('title' not in i or i['alt'] == i['title'] for i in imgs)
3560
        alt = imgs[0].get('alt', "") if imgs else []
3561
        return {
3562
            'title': title,
3563
            'alt': alt,
3564
            'description': desc,
3565
            'author': author,
3566
            'day': day.day,
3567
            'month': day.month,
3568
            'year': day.year,
3569
            'img': [urljoin_wrapper(cls.url, i['src']) for i in imgs],
3570
        }
3571
3572
3573
class GloryOwlComix(GenericBlogspotComic):
3574
    """Class to retrieve Glory Owl comics."""
3575
    name = 'gloryowl'
@@ 3470-3487 (lines=18) @@
3467
        return {
3468
            'title': title,
3469
            'img': [i['content'] for i in imgs],
3470
            'day': day.day,
3471
            'month': day.month,
3472
            'year': day.year,
3473
        }
3474
3475
3476
class GenericBlogspotComic(GenericNavigableComic):
3477
    """Generic class to retrieve comics from Blogspot."""
3478
    get_first_comic_link = simulate_first_link
3479
    first_url = NotImplemented
3480
    _categories = ('BLOGSPOT', )
3481
3482
    @classmethod
3483
    def get_navi_link(cls, last_soup, next_):
3484
        """Get link to next or previous comic."""
3485
        return last_soup.find('a', id='Blog1_blog-pager-newer-link' if next_ else 'Blog1_blog-pager-older-link')
3486
3487
3488
class TuMourrasMoinsBete(GenericBlogspotComic):
3489
    """Class to retrieve Tu Mourras Moins Bete comics."""
3490
    name = 'mourrasmoinsbete'