Code Duplication    Length = 24-25 lines in 2 locations

comics.py 2 locations

@@ 1560-1584 (lines=25) @@
1557
            'description': desc,
1558
        }
1559
1560
1561
class ScandinaviaAndTheWorld(GenericNavigableComic):
1562
    """Class to retrieve Scandinavia And The World comics."""
1563
    name = 'satw'
1564
    long_name = 'Scandinavia And The World'
1565
    url = 'http://satwcomic.com'
1566
1567
    @classmethod
1568
    def get_first_comic_link(cls):
1569
        """Get link to first comics."""
1570
        return {'href': 'http://satwcomic.com/sweden-denmark-and-norway'}
1571
1572
    @classmethod
1573
    def get_navi_link(cls, last_soup, next_):
1574
        return last_soup.find('a', accesskey='n' if next_ else 'p')
1575
1576
    @classmethod
1577
    def get_comic_info(cls, soup, link):
1578
        """Get information about a particular comics."""
1579
        title = soup.find('meta', attrs={'name': 'twitter:label1'})['content']
1580
        desc = soup.find('meta', property='og:description')['content']
1581
        imgs = soup.find_all('img', itemprop="image")
1582
        return {
1583
            'title': title,
1584
            'description': desc,
1585
            'img': [i['src'] for i in imgs],
1586
        }
1587
@@ 2059-2082 (lines=24) @@
2056
            'author': author,
2057
        }
2058
2059
2060
class DepressedAlien(GenericNavigableComic):
2061
    """Class to retrieve Depressed Alien Comics."""
2062
    name = 'depressedalien'
2063
    long_name = 'Depressed Alien'
2064
    url = 'http://depressedalien.com'
2065
    get_url_from_link = join_cls_url_to_href
2066
2067
    @classmethod
2068
    def get_first_comic_link(cls):
2069
        """Get link to first comics."""
2070
        return get_soup_at_url(cls.url).find('img', attrs={'name': 'beginArrow'}).parent
2071
2072
    @classmethod
2073
    def get_navi_link(cls, last_soup, next_):
2074
        return last_soup.find('img', attrs={'name': 'rightArrow' if next_ else 'leftArrow'}).parent
2075
2076
    @classmethod
2077
    def get_comic_info(cls, soup, link):
2078
        """Get information about a particular comics."""
2079
        title = soup.find('meta', attrs={'name': 'twitter:title'})['content']
2080
        imgs = soup.find_all('meta', property='og:image')
2081
        return {
2082
            'title': title,
2083
            'img': [i['content'] for i in imgs],
2084
        }
2085