Code Duplication    Length = 23-28 lines in 3 locations

comics.py 3 locations

@@ 1092-1119 (lines=28) @@
1089
        }
1090
1091
1092
class Mercworks(GenericDeletedComic):  # Moved to Webtoons
1093
    """Class to retrieve Mercworks comics."""
1094
    # Also on http://mercworks.tumblr.com
1095
    # Also on http://www.webtoons.com/en/comedy/mercworks/list?title_no=426
1096
    # Also on https://tapastic.com/series/MercWorks
1097
    name = 'mercworks'
1098
    long_name = 'Mercworks'
1099
    url = 'http://mercworks.net'
1100
    _categories = ('MERCWORKS', )
1101
    get_first_comic_link = get_a_comicnavbase_comicnavfirst
1102
    get_navi_link = get_link_rel_next
1103
1104
    @classmethod
1105
    def get_comic_info(cls, soup, link):
1106
        """Get information about a particular comics."""
1107
        title = soup.find('meta', property='og:title')['content']
1108
        metadesc = soup.find('meta', property='og:description')
1109
        desc = metadesc['content'] if metadesc else ""
1110
        date_str = soup.find('meta', property='article:published_time')['content'][:10]
1111
        day = string_to_date(date_str, "%Y-%m-%d")
1112
        imgs = soup.find_all('meta', property='og:image')
1113
        return {
1114
            'img': [i['content'] for i in imgs],
1115
            'title': title,
1116
            'desc': desc,
1117
            'day': day.day,
1118
            'month': day.month,
1119
            'year': day.year
1120
        }
1121
1122
@@ 405-430 (lines=26) @@
402
    _categories = ('DELETED', )
403
404
405
class ExtraFabulousComics(GenericNavigableComic):
406
    """Class to retrieve Extra Fabulous Comics."""
407
    # Also on https://extrafabulouscomics.tumblr.com
408
    name = 'efc'
409
    long_name = 'Extra Fabulous Comics'
410
    url = 'http://extrafabulouscomics.com'
411
    _categories = ('EFC', )
412
    get_navi_link = get_link_rel_next
413
    get_first_comic_link = simulate_first_link
414
    first_url = 'http://extrafabulouscomics.com/comic/buttfly/'
415
416
    @classmethod
417
    def get_comic_info(cls, soup, link):
418
        """Get information about a particular comics."""
419
        img_src_re = re.compile('^%s/wp-content/uploads/' % cls.url)
420
        imgs = soup.find_all('img', src=img_src_re)
421
        title = soup.find('meta', property='og:title')['content']
422
        date_str = soup.find('meta', property='article:published_time')['content'][:10]
423
        day = string_to_date(date_str, "%Y-%m-%d")
424
        return {
425
            'title': title,
426
            'img': [i['src'] for i in imgs],
427
            'month': day.month,
428
            'year': day.year,
429
            'day': day.day,
430
            'prefix': title + '-'
431
        }
432
433
@@ 2482-2504 (lines=23) @@
2479
    _categories = ('WARANDPEAS', 'LINS')
2480
2481
2482
class WarAndPeas(GenericNavigableComic):
2483
    """Class to retrieve War And Peas comics."""
2484
    name = 'warandpeas'
2485
    long_name = 'War And Peas'
2486
    url = 'https://warandpeas.com'
2487
    get_navi_link = get_link_rel_next
2488
    get_first_comic_link = simulate_first_link
2489
    first_url = 'https://warandpeas.com/2011/11/07/565/'
2490
    _categories = ('WARANDPEAS', 'LINS')
2491
2492
    @classmethod
2493
    def get_comic_info(cls, soup, link):
2494
        """Get information about a particular comics."""
2495
        title = soup.find('meta', property='og:title')['content']
2496
        imgs = soup.find_all('meta', property='og:image')
2497
        date_str = soup.find('meta', property='article:published_time')['content'][:10]
2498
        day = string_to_date(date_str, "%Y-%m-%d")
2499
        return {
2500
            'title': title,
2501
            'img': [i['content'] for i in imgs],
2502
            'month': day.month,
2503
            'year': day.year,
2504
            'day': day.day,
2505
        }
2506
2507