Code Duplication    Length = 18-18 lines in 2 locations

comics.py 2 locations

@@ 3672-3689 (lines=18) @@
3669
3670
    @classmethod
3671
    def get_comic_info(cls, soup, link):
3672
        """Get information about a particular comics."""
3673
        title = soup.find('meta', property='og:title')['content']
3674
        desc = soup.find('meta', property='og:description')
3675
        desc_str = "" if desc is None else desc['content']
3676
        date_str = soup.find('time', class_='published')['datetime']
3677
        day = string_to_date(date_str, "%Y-%m-%d")
3678
        author = soup.find('a', rel='author').string
3679
        div_content = (soup.find('div', class_="body entry-content") or
3680
                       soup.find('div', class_="special-content"))
3681
        imgs = div_content.find_all('img')
3682
        imgs = [i for i in imgs if i.get('src') is not None]
3683
        assert all('title' not in i or i['alt'] == i['title'] for i in imgs)
3684
        alt = imgs[0].get('alt', "") if imgs else []
3685
        return {
3686
            'title': title,
3687
            'alt': alt,
3688
            'description': desc_str,
3689
            'author': author,
3690
            'day': day.day,
3691
            'month': day.month,
3692
            'year': day.year,
@@ 3586-3603 (lines=18) @@
3583
    @classmethod
3584
    def get_comic_info(cls, soup, link):
3585
        """Get information about a particular comics."""
3586
        title = soup.find('meta', property='og:title')['content']
3587
        date_str = soup.find('time')["datetime"]
3588
        day = string_to_date(date_str, "%Y-%m-%d")
3589
        imgs = soup.find_all('meta', property='og:image')
3590
        return {
3591
            'title': title,
3592
            'img': [i['content'] for i in imgs],
3593
            'day': day.day,
3594
            'month': day.month,
3595
            'year': day.year,
3596
        }
3597
3598
3599
class GenericBlogspotComic(GenericNavigableComic):
3600
    """Generic class to retrieve comics from Blogspot."""
3601
    get_first_comic_link = simulate_first_link
3602
    first_url = NotImplemented
3603
    _categories = ('BLOGSPOT', )
3604
3605
    @classmethod
3606
    def get_navi_link(cls, last_soup, next_):