Code Duplication    Length = 25-26 lines in 2 locations

comics.py 2 locations

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