Code Duplication    Length = 18-18 lines in 2 locations

comics.py 2 locations

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