Code Duplication    Length = 29-31 lines in 2 locations

comics.py 2 locations

@@ 1509-1539 (lines=31) @@
1506
1507
class Octopuns(GenericComicNotWorking, GenericNavigableComic):  # Website has changed
1508
    """Class to retrieve Octopuns comics."""
1509
    # Also on http://octopuns.tumblr.com
1510
    name = 'octopuns'
1511
    long_name = 'Octopuns'
1512
    url = 'http://www.octopuns.net'
1513
1514
    @classmethod
1515
    def get_first_comic_link(cls):
1516
        """Get link to first comics."""
1517
        return get_soup_at_url(cls.url).find('img', src=re.compile('.*/First.png')).parent
1518
1519
    @classmethod
1520
    def get_navi_link(cls, last_soup, next_):
1521
        """Get link to next or previous comic."""
1522
        link = last_soup.find('img', src=re.compile('.*/Next.png' if next_ else '.*/Back.png')).parent
1523
        return None if link.get('href') is None else link
1524
1525
    @classmethod
1526
    def get_comic_info(cls, soup, link):
1527
        """Get information about a particular comics."""
1528
        title = soup.find('h3', class_='post-title entry-title').string
1529
        date_str = soup.find('h2', class_='date-header').string
1530
        day = string_to_date(date_str, "%A, %B %d, %Y")
1531
        imgs = soup.find_all('link', rel='image_src')
1532
        return {
1533
            'img': [i['href'] for i in imgs],
1534
            'title': title,
1535
            'day': day.day,
1536
            'month': day.month,
1537
            'year': day.year,
1538
        }
1539
1540
1541
class Quarktees(GenericNavigableComic):
1542
    """Class to retrieve the Quarktees comics."""
@@ 2089-2117 (lines=29) @@
2086
2087
class LoadingComics(GenericNavigableComic):
2088
    """Class to retrieve Loading Artist comics."""
2089
    name = 'loadingartist'
2090
    long_name = 'Loading Artist'
2091
    url = 'http://www.loadingartist.com/latest'
2092
2093
    @classmethod
2094
    def get_first_comic_link(cls):
2095
        """Get link to first comics."""
2096
        return get_soup_at_url(cls.url).find('a', title="First")
2097
2098
    @classmethod
2099
    def get_navi_link(cls, last_soup, next_):
2100
        """Get link to next or previous comic."""
2101
        return last_soup.find('a', title='Next' if next_ else 'Previous')
2102
2103
    @classmethod
2104
    def get_comic_info(cls, soup, link):
2105
        """Get information about a particular comics."""
2106
        title = soup.find('h1').string
2107
        date_str = soup.find('span', class_='date').string.strip()
2108
        day = string_to_date(date_str, "%B %d, %Y")
2109
        imgs = soup.find('div', class_='comic').find_all('img', alt='', title='')
2110
        return {
2111
            'title': title,
2112
            'img': [i['src'] for i in imgs],
2113
            'month': day.month,
2114
            'year': day.year,
2115
            'day': day.day,
2116
        }
2117
2118
2119
class ChuckleADuck(GenericNavigableComic):
2120
    """Class to retrieve Chuckle-A-Duck comics."""