Code Duplication    Length = 19-21 lines in 2 locations

comics.py 2 locations

@@ 3056-3076 (lines=21) @@
3053
3054
    @classmethod
3055
    def get_comic_info(cls, soup, link):
3056
        """Get information about a particular comics."""
3057
        title = soup.find('meta', property='og:title')['content']
3058
        desc = soup.find('meta', property='og:description')['content']
3059
        date_str = soup.find('time')["datetime"]
3060
        day = string_to_date(date_str, "%Y-%m-%d")
3061
        imgs = soup.find('figure').find_all('img')
3062
        return {
3063
            'title': title,
3064
            'description': desc,
3065
            'day': day.day,
3066
            'month': day.month,
3067
            'year': day.year,
3068
            'img': [i['src'] for i in imgs],
3069
        }
3070
3071
3072
class LittleLifeLines(GenericNavigableComic):
3073
    """Class to retrieve Little Life Lines comics."""
3074
    # Also on https://little-life-lines.tumblr.com
3075
    name = 'life'
3076
    long_name = 'Little Life Lines'
3077
    url = 'http://www.littlelifelines.com'
3078
    get_url_from_link = join_cls_url_to_href
3079
    get_first_comic_link = simulate_first_link
@@ 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