Code Duplication    Length = 29-31 lines in 2 locations

comics.py 2 locations

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