Code Duplication    Length = 22-25 lines in 4 locations

comics.py 4 locations

@@ 357-379 (lines=23) @@
354
    def get_next_comic(cls, last_comic):
355
        """Implementation of get_next_comic returning no comics."""
356
        cls.log("comic is considered as empty - returning no comic")
357
        return []
358
359
360
class ExtraFabulousComics(GenericNavigableComic):
361
    """Class to retrieve Extra Fabulous Comics."""
362
    name = 'efc'
363
    long_name = 'Extra Fabulous Comics'
364
    url = 'http://extrafabulouscomics.com'
365
    get_first_comic_link = get_a_navi_navifirst
366
    get_navi_link = get_link_rel_next
367
368
    @classmethod
369
    def get_comic_info(cls, soup, link):
370
        """Get information about a particular comics."""
371
        img_src_re = re.compile('^%s/wp-content/uploads/' % cls.url)
372
        imgs = soup.find_all('img', src=img_src_re)
373
        title = soup.find('meta', property='og:title')['content']
374
        date_str = soup.find('meta', property='article:published_time')['content'][:10]
375
        day = string_to_date(date_str, "%Y-%m-%d")
376
        return {
377
            'title': title,
378
            'img': [i['src'] for i in imgs],
379
            'month': day.month,
380
            'year': day.year,
381
            'day': day.day,
382
            'prefix': title + '-'
@@ 2371-2395 (lines=25) @@
2368
            'month': day.month,
2369
            'year': day.year,
2370
            'day': day.day,
2371
        }
2372
2373
2374
class LinsEditions(GenericNavigableComic):
2375
    """Class to retrieve L.I.N.S. Editions comics."""
2376
    # Also on https://linscomics.tumblr.com
2377
    # Now on https://warandpeas.com
2378
    name = 'lins'
2379
    long_name = 'L.I.N.S. Editions'
2380
    url = 'https://linsedition.com'
2381
    _categories = ('LINS', )
2382
    get_navi_link = get_link_rel_next
2383
    get_first_comic_link = simulate_first_link
2384
    first_url = 'https://linsedition.com/2011/09/07/l-i-n-s/'
2385
2386
    @classmethod
2387
    def get_comic_info(cls, soup, link):
2388
        """Get information about a particular comics."""
2389
        title = soup.find('meta', property='og:title')['content']
2390
        imgs = soup.find_all('meta', property='og:image')
2391
        date_str = soup.find('meta', property='article:published_time')['content'][:10]
2392
        day = string_to_date(date_str, "%Y-%m-%d")
2393
        return {
2394
            'title': title,
2395
            'img': [i['content'] for i in imgs],
2396
            'month': day.month,
2397
            'year': day.year,
2398
            'day': day.day,
@@ 1043-1067 (lines=25) @@
1040
        return {
1041
            'name': name,
1042
            'img': [i['content'] for i in imgs],
1043
        }
1044
1045
1046
class Mercworks(GenericNavigableComic):
1047
    """Class to retrieve Mercworks comics."""
1048
    # Also on http://mercworks.tumblr.com
1049
    name = 'mercworks'
1050
    long_name = 'Mercworks'
1051
    url = 'http://mercworks.net'
1052
    get_first_comic_link = get_a_comicnavbase_comicnavfirst
1053
    get_navi_link = get_link_rel_next
1054
1055
    @classmethod
1056
    def get_comic_info(cls, soup, link):
1057
        """Get information about a particular comics."""
1058
        title = soup.find('meta', property='og:title')['content']
1059
        metadesc = soup.find('meta', property='og:description')
1060
        desc = metadesc['content'] if metadesc else ""
1061
        date_str = soup.find('meta', property='article:published_time')['content'][:10]
1062
        day = string_to_date(date_str, "%Y-%m-%d")
1063
        imgs = soup.find_all('meta', property='og:image')
1064
        return {
1065
            'img': [i['content'] for i in imgs],
1066
            'title': title,
1067
            'desc': desc,
1068
            'day': day.day,
1069
            'month': day.month,
1070
            'year': day.year
@@ 3312-3333 (lines=22) @@
3309
        return {
3310
            'title': title,
3311
            'img': [i['src'] for i in imgs],
3312
        }
3313
3314
3315
class MarketoonistComics(GenericNavigableComic):
3316
    """Class to retrieve Marketoonist Comics."""
3317
    name = 'marketoonist'
3318
    long_name = 'Marketoonist'
3319
    url = 'https://marketoonist.com/cartoons'
3320
    get_first_comic_link = simulate_first_link
3321
    get_navi_link = get_link_rel_next
3322
    first_url = 'https://marketoonist.com/2002/10/the-8-types-of-brand-managers-2.html'
3323
3324
    @classmethod
3325
    def get_comic_info(cls, soup, link):
3326
        """Get information about a particular comics."""
3327
        imgs = soup.find_all('meta', property='og:image')
3328
        date_str = soup.find('meta', property='article:published_time')['content'][:10]
3329
        day = string_to_date(date_str, "%Y-%m-%d")
3330
        title = soup.find('meta', property='og:title')['content']
3331
        return {
3332
            'img': [i['content'] for i in imgs],
3333
            'day': day.day,
3334
            'month': day.month,
3335
            'year': day.year,
3336
            'title': title,