Code Duplication    Length = 19-21 lines in 2 locations

comics.py 2 locations

@@ 3056-3076 (lines=21) @@
3053
        li = last_soup.find('li', class_='prev' if next_ else 'next')
3054
        return li.find('a') if li else None
3055
3056
    @classmethod
3057
    def get_comic_info(cls, soup, link):
3058
        """Get information about a particular comics."""
3059
        title = soup.find('meta', property='og:title')['content']
3060
        desc = soup.find('meta', property='og:description')['content']
3061
        date_str = soup.find('time', class_='published')['datetime']
3062
        day = string_to_date(date_str, "%Y-%m-%d")
3063
        author = soup.find('a', rel='author').string
3064
        div_content = soup.find('div', class_="body entry-content")
3065
        imgs = div_content.find_all('img')
3066
        imgs = [i for i in imgs if i.get('src') is not None]
3067
        alt = imgs[0]['alt']
3068
        return {
3069
            'title': title,
3070
            'alt': alt,
3071
            'description': desc,
3072
            'author': author,
3073
            'day': day.day,
3074
            'month': day.month,
3075
            'year': day.year,
3076
            'img': [i['src'] for i in imgs],
3077
        }
3078
3079
@@ 847-865 (lines=19) @@
844
        link = last_soup.find('div', class_='nav-comic nav-right' if next_ else 'nav-comic nav-left')
845
        return link.find('a') if link else None
846
847
    @classmethod
848
    def get_comic_info(cls, soup, link):
849
        """Get information about a particular comics."""
850
        title = soup.find('meta', property='og:title')['content']
851
        imgs = soup.find_all('meta', property='og:image')
852
        desc = soup.find('meta', property='og:description')['content']
853
        date_str = soup.find('meta', property='article:publish_date')['content']
854
        day = string_to_date(date_str, "%B %d, %Y")
855
        author = soup.find('meta', property='article:author')['content']
856
        tags = soup.find('meta', property='article:tag')['content']
857
        return {
858
            'title': title,
859
            'description': desc,
860
            'img': [i['content'] for i in imgs],
861
            'author': author,
862
            'tags': tags,
863
            'day': day.day,
864
            'month': day.month,
865
            'year': day.year
866
        }
867
868