Code Duplication    Length = 25-26 lines in 2 locations

comics.py 2 locations

@@ 1938-1963 (lines=26) @@
1935
class Penmen(GenericComicNotWorking, GenericNavigableComic):
1936
    """Class to retrieve Penmen comics."""
1937
    name = 'penmen'
1938
    long_name = 'Penmen'
1939
    url = 'http://penmen.com'
1940
    get_navi_link = get_link_rel_next
1941
    get_first_comic_link = simulate_first_link
1942
    first_url = 'http://penmen.com/index.php/2016/09/12/penmen-announces-grin-big-brand-clothing/'
1943
1944
    @classmethod
1945
    def get_comic_info(cls, soup, link):
1946
        """Get information about a particular comics."""
1947
        title = soup.find('title').string
1948
        imgs = soup.find('div', class_='entry-content').find_all('img')
1949
        short_url = soup.find('link', rel='shortlink')['href']
1950
        tags = ' '.join(t.string for t in soup.find_all('a', rel='tag'))
1951
        date_str = soup.find('time')['datetime'][:10]
1952
        day = string_to_date(date_str, "%Y-%m-%d")
1953
        return {
1954
            'title': title,
1955
            'short_url': short_url,
1956
            'img': [i['src'] for i in imgs],
1957
            'tags': tags,
1958
            'month': day.month,
1959
            'year': day.year,
1960
            'day': day.day,
1961
        }
1962
1963
1964
class TheDoghouseDiaries(GenericDeletedComic, GenericNavigableComic):
1965
    """Class to retrieve The Dog House Diaries comics."""
1966
    name = 'doghouse'
@@ 3488-3512 (lines=25) @@
3485
            'title': title,
3486
            'img': [i['src'] for i in imgs],
3487
        }
3488
3489
3490
class OffTheLeashDog(GenericNavigableComic):
3491
    """Class to retrieve Off The Leash Dog comics."""
3492
    # Also on http://rupertfawcettsdoggyblog.tumblr.com
3493
    # Also on http://www.rupertfawcettcartoons.com
3494
    name = 'offtheleash'
3495
    long_name = 'Off The Leash Dog'
3496
    url = 'http://offtheleashdogcartoons.com'
3497
    _categories = ('FAWCETT', )
3498
    get_navi_link = get_a_rel_next
3499
    get_first_comic_link = simulate_first_link
3500
    first_url = 'http://offtheleashdogcartoons.com/uncategorized/can-i-help-you/'
3501
3502
    @classmethod
3503
    def get_comic_info(cls, soup, link):
3504
        """Get information about a particular comics."""
3505
        title = soup.find("h1", class_="entry-title").string
3506
        imgs = soup.find('div', class_='entry-content').find_all('img')
3507
        return {
3508
            'title': title,
3509
            'img': [i['src'] for i in imgs],
3510
        }
3511
3512
3513
class MacadamValley(GenericNavigableComic):
3514
    """Class to retrieve Macadam Valley comics."""
3515
    name = 'macadamvalley'