Code Duplication    Length = 24-25 lines in 2 locations

comics.py 2 locations

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