Code Duplication    Length = 22-25 lines in 4 locations

comics.py 4 locations

@@ 357-379 (lines=23) @@
354
        return []
355
356
357
class ExtraFabulousComics(GenericNavigableComic):
358
    """Class to retrieve Extra Fabulous Comics."""
359
    name = 'efc'
360
    long_name = 'Extra Fabulous Comics'
361
    url = 'http://extrafabulouscomics.com'
362
    get_first_comic_link = get_a_navi_navifirst
363
    get_navi_link = get_link_rel_next
364
365
    @classmethod
366
    def get_comic_info(cls, soup, link):
367
        """Get information about a particular comics."""
368
        img_src_re = re.compile('^%s/wp-content/uploads/' % cls.url)
369
        imgs = soup.find_all('img', src=img_src_re)
370
        title = soup.find('meta', property='og:title')['content']
371
        date_str = soup.find('meta', property='article:published_time')['content'][:10]
372
        day = string_to_date(date_str, "%Y-%m-%d")
373
        return {
374
            'title': title,
375
            'img': [i['src'] for i in imgs],
376
            'month': day.month,
377
            'year': day.year,
378
            'day': day.day,
379
            'prefix': title + '-'
380
        }
381
382
@@ 2354-2378 (lines=25) @@
2351
        }
2352
2353
2354
class LinsEditions(GenericNavigableComic):
2355
    """Class to retrieve L.I.N.S. Editions comics."""
2356
    # Also on https://linscomics.tumblr.com
2357
    # Now on https://warandpeas.com
2358
    name = 'lins'
2359
    long_name = 'L.I.N.S. Editions'
2360
    url = 'https://linsedition.com'
2361
    _categories = ('LINS', )
2362
    get_navi_link = get_link_rel_next
2363
    get_first_comic_link = simulate_first_link
2364
    first_url = 'https://linsedition.com/2011/09/07/l-i-n-s/'
2365
2366
    @classmethod
2367
    def get_comic_info(cls, soup, link):
2368
        """Get information about a particular comics."""
2369
        title = soup.find('meta', property='og:title')['content']
2370
        imgs = soup.find_all('meta', property='og:image')
2371
        date_str = soup.find('meta', property='article:published_time')['content'][:10]
2372
        day = string_to_date(date_str, "%Y-%m-%d")
2373
        return {
2374
            'title': title,
2375
            'img': [i['content'] for i in imgs],
2376
            'month': day.month,
2377
            'year': day.year,
2378
            'day': day.day,
2379
        }
2380
2381
@@ 1050-1074 (lines=25) @@
1047
        }
1048
1049
1050
class Mercworks(GenericNavigableComic):
1051
    """Class to retrieve Mercworks comics."""
1052
    # Also on http://mercworks.tumblr.com
1053
    name = 'mercworks'
1054
    long_name = 'Mercworks'
1055
    url = 'http://mercworks.net'
1056
    get_first_comic_link = get_a_comicnavbase_comicnavfirst
1057
    get_navi_link = get_link_rel_next
1058
1059
    @classmethod
1060
    def get_comic_info(cls, soup, link):
1061
        """Get information about a particular comics."""
1062
        title = soup.find('meta', property='og:title')['content']
1063
        metadesc = soup.find('meta', property='og:description')
1064
        desc = metadesc['content'] if metadesc else ""
1065
        date_str = soup.find('meta', property='article:published_time')['content'][:10]
1066
        day = string_to_date(date_str, "%Y-%m-%d")
1067
        imgs = soup.find_all('meta', property='og:image')
1068
        return {
1069
            'img': [i['content'] for i in imgs],
1070
            'title': title,
1071
            'desc': desc,
1072
            'day': day.day,
1073
            'month': day.month,
1074
            'year': day.year
1075
        }
1076
1077
@@ 3295-3316 (lines=22) @@
3292
        }
3293
3294
3295
class MarketoonistComics(GenericNavigableComic):
3296
    """Class to retrieve Marketoonist Comics."""
3297
    name = 'marketoonist'
3298
    long_name = 'Marketoonist'
3299
    url = 'https://marketoonist.com/cartoons'
3300
    get_first_comic_link = simulate_first_link
3301
    get_navi_link = get_link_rel_next
3302
    first_url = 'https://marketoonist.com/2002/10/the-8-types-of-brand-managers-2.html'
3303
3304
    @classmethod
3305
    def get_comic_info(cls, soup, link):
3306
        """Get information about a particular comics."""
3307
        imgs = soup.find_all('meta', property='og:image')
3308
        date_str = soup.find('meta', property='article:published_time')['content'][:10]
3309
        day = string_to_date(date_str, "%Y-%m-%d")
3310
        title = soup.find('meta', property='og:title')['content']
3311
        return {
3312
            'img': [i['content'] for i in imgs],
3313
            'day': day.day,
3314
            'month': day.month,
3315
            'year': day.year,
3316
            'title': title,
3317
        }
3318
3319