Code Duplication    Length = 22-25 lines in 4 locations

comics.py 4 locations

@@ 355-377 (lines=23) @@
352
        return []
353
354
355
class ExtraFabulousComics(GenericNavigableComic):
356
    """Class to retrieve Extra Fabulous Comics."""
357
    name = 'efc'
358
    long_name = 'Extra Fabulous Comics'
359
    url = 'http://extrafabulouscomics.com'
360
    get_first_comic_link = get_a_navi_navifirst
361
    get_navi_link = get_link_rel_next
362
363
    @classmethod
364
    def get_comic_info(cls, soup, link):
365
        """Get information about a particular comics."""
366
        img_src_re = re.compile('^%s/wp-content/uploads/' % cls.url)
367
        imgs = soup.find_all('img', src=img_src_re)
368
        title = soup.find('meta', property='og:title')['content']
369
        date_str = soup.find('meta', property='article:published_time')['content'][:10]
370
        day = string_to_date(date_str, "%Y-%m-%d")
371
        return {
372
            'title': title,
373
            'img': [i['src'] for i in imgs],
374
            'month': day.month,
375
            'year': day.year,
376
            'day': day.day,
377
            'prefix': title + '-'
378
        }
379
380
@@ 2320-2344 (lines=25) @@
2317
        }
2318
2319
2320
class LinsEditions(GenericNavigableComic):
2321
    """Class to retrieve L.I.N.S. Editions comics."""
2322
    # Also on http://linscomics.tumblr.com
2323
    # Now on https://warandpeas.com
2324
    name = 'lins'
2325
    long_name = 'L.I.N.S. Editions'
2326
    url = 'https://linsedition.com'
2327
    _categories = ('LINS', )
2328
    get_navi_link = get_link_rel_next
2329
    get_first_comic_link = simulate_first_link
2330
    first_url = 'https://linsedition.com/2011/09/07/l-i-n-s/'
2331
2332
    @classmethod
2333
    def get_comic_info(cls, soup, link):
2334
        """Get information about a particular comics."""
2335
        title = soup.find('meta', property='og:title')['content']
2336
        imgs = soup.find_all('meta', property='og:image')
2337
        date_str = soup.find('meta', property='article:published_time')['content'][:10]
2338
        day = string_to_date(date_str, "%Y-%m-%d")
2339
        return {
2340
            'title': title,
2341
            'img': [i['content'] for i in imgs],
2342
            'month': day.month,
2343
            'year': day.year,
2344
            'day': day.day,
2345
        }
2346
2347
@@ 1016-1040 (lines=25) @@
1013
        }
1014
1015
1016
class Mercworks(GenericNavigableComic):
1017
    """Class to retrieve Mercworks comics."""
1018
    # Also on http://mercworks.tumblr.com
1019
    name = 'mercworks'
1020
    long_name = 'Mercworks'
1021
    url = 'http://mercworks.net'
1022
    get_first_comic_link = get_a_comicnavbase_comicnavfirst
1023
    get_navi_link = get_link_rel_next
1024
1025
    @classmethod
1026
    def get_comic_info(cls, soup, link):
1027
        """Get information about a particular comics."""
1028
        title = soup.find('meta', property='og:title')['content']
1029
        metadesc = soup.find('meta', property='og:description')
1030
        desc = metadesc['content'] if metadesc else ""
1031
        date_str = soup.find('meta', property='article:published_time')['content'][:10]
1032
        day = string_to_date(date_str, "%Y-%m-%d")
1033
        imgs = soup.find_all('meta', property='og:image')
1034
        return {
1035
            'img': [i['content'] for i in imgs],
1036
            'title': title,
1037
            'desc': desc,
1038
            'day': day.day,
1039
            'month': day.month,
1040
            'year': day.year
1041
        }
1042
1043
@@ 3261-3282 (lines=22) @@
3258
        }
3259
3260
3261
class MarketoonistComics(GenericNavigableComic):
3262
    """Class to retrieve Marketoonist Comics."""
3263
    name = 'marketoonist'
3264
    long_name = 'Marketoonist'
3265
    url = 'https://marketoonist.com/cartoons'
3266
    get_first_comic_link = simulate_first_link
3267
    get_navi_link = get_link_rel_next
3268
    first_url = 'https://marketoonist.com/2002/10/the-8-types-of-brand-managers-2.html'
3269
3270
    @classmethod
3271
    def get_comic_info(cls, soup, link):
3272
        """Get information about a particular comics."""
3273
        imgs = soup.find_all('meta', property='og:image')
3274
        date_str = soup.find('meta', property='article:published_time')['content'][:10]
3275
        day = string_to_date(date_str, "%Y-%m-%d")
3276
        title = soup.find('meta', property='og:title')['content']
3277
        return {
3278
            'img': [i['content'] for i in imgs],
3279
            'day': day.day,
3280
            'month': day.month,
3281
            'year': day.year,
3282
            'title': title,
3283
        }
3284
3285