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
class MacadamValley(GenericNavigableComic):
3486
    """Class to retrieve Macadam Valley comics."""
3487
    name = 'macadamvalley'
3488
    long_name = 'Macadam Valley'
3489
    url = 'http://macadamvalley.com'
3490
    get_navi_link = get_a_rel_next
3491
    get_first_comic_link = simulate_first_link
3492
    first_url = 'http://macadamvalley.com/le-debut-de-la-fin/'
3493
3494
    @classmethod
3495
    def get_comic_info(cls, soup, link):
3496
        """Get information about a particular comics."""
3497
        title = soup.find("h1", class_="entry-title").string
3498
        img = soup.find('div', class_='entry-content').find('img')
3499
        date_str = soup.find('time', class_='entry-date')['datetime']
3500
        date_str = date_str[:10]
3501
        day = string_to_date(date_str, "%Y-%m-%d")
3502
        author = soup.find('a', rel='author').string
3503
        return {
3504
            'title': title,
3505
            'img': [i['src'] for i in [img]],
3506
            'day': day.day,
3507
            'month': day.month,
3508
            'year': day.year,
3509
            'author': author,
3510
        }
3511
3512
3513
class MarketoonistComics(GenericNavigableComic):
3514
    """Class to retrieve Marketoonist Comics."""
3515
    name = 'marketoonist'