Code Duplication    Length = 25-26 lines in 2 locations

comics.py 2 locations

@@ 2988-3013 (lines=26) @@
2985
    url = 'http://woodenplankstudios.com'
2986
2987
2988
class ElectricBunnyComic(GenericNavigableComic):
2989
    """Class to retrieve Electric Bunny Comics."""
2990
    # Also on http://electricbunnycomics.tumblr.com
2991
    name = 'bunny'
2992
    long_name = 'Electric Bunny Comic'
2993
    url = 'http://www.electricbunnycomics.com/View/Comic/153/Welcome+to+Hell'
2994
    get_url_from_link = join_cls_url_to_href
2995
2996
    @classmethod
2997
    def get_first_comic_link(cls):
2998
        """Get link to first comics."""
2999
        return get_soup_at_url(cls.url).find('img', alt='First').parent
3000
3001
    @classmethod
3002
    def get_navi_link(cls, last_soup, next_):
3003
        img = last_soup.find('img', alt='Next' if next_ else 'Back')
3004
        return img.parent if img else None
3005
3006
    @classmethod
3007
    def get_comic_info(cls, soup, link):
3008
        """Get information about a particular comics."""
3009
        title = soup.find('meta', property='og:title')['content']
3010
        imgs = soup.find_all('meta', property='og:image')
3011
        return {
3012
            'title': title,
3013
            'img': [i['content'] for i in imgs],
3014
        }
3015
3016
@@ 1467-1491 (lines=25) @@
1464
        }
1465
1466
1467
class Quarktees(GenericNavigableComic):
1468
    """Class to retrieve the Quarktees comics."""
1469
    name = 'quarktees'
1470
    long_name = 'Quarktees'
1471
    url = 'http://www.quarktees.com/blogs/news'
1472
    get_url_from_link = join_cls_url_to_href
1473
1474
    @classmethod
1475
    def get_first_comic_link(cls):
1476
        """Get link to first comics."""
1477
        return {'href': 'http://www.quarktees.com/blogs/news/12486621-coming-soon'}
1478
1479
    @classmethod
1480
    def get_navi_link(cls, last_soup, next_):
1481
        return last_soup.find('a', id='article-next' if next_ else 'article-prev')
1482
1483
    @classmethod
1484
    def get_comic_info(cls, soup, link):
1485
        """Get information about a particular comics."""
1486
        title = soup.find('meta', property='og:title')['content']
1487
        article = soup.find('div', class_='single-article')
1488
        imgs = article.find_all('img')
1489
        return {
1490
            'title': title,
1491
            'img': [urljoin_wrapper(cls.url, i['src']) for i in imgs],
1492
        }
1493
1494