Code Duplication    Length = 13-16 lines in 3 locations

comics.py 3 locations

@@ 1052-1067 (lines=16) @@
1049
    get_first_comic_link = get_a_comicnavbase_comicnavfirst
1050
    get_navi_link = get_link_rel_next
1051
1052
    @classmethod
1053
    def get_comic_info(cls, soup, link):
1054
        """Get information about a particular comics."""
1055
        title = soup.find('meta', property='og:title')['content']
1056
        metadesc = soup.find('meta', property='og:description')
1057
        desc = metadesc['content'] if metadesc else ""
1058
        date_str = soup.find('meta', property='article:published_time')['content'][:10]
1059
        day = string_to_date(date_str, "%Y-%m-%d")
1060
        imgs = soup.find_all('meta', property='og:image')
1061
        return {
1062
            'img': [i['content'] for i in imgs],
1063
            'title': title,
1064
            'desc': desc,
1065
            'day': day.day,
1066
            'month': day.month,
1067
            'year': day.year
1068
        }
1069
1070
@@ 3297-3309 (lines=13) @@
3294
    get_navi_link = get_link_rel_next
3295
    first_url = 'https://marketoonist.com/2002/10/the-8-types-of-brand-managers-2.html'
3296
3297
    @classmethod
3298
    def get_comic_info(cls, soup, link):
3299
        """Get information about a particular comics."""
3300
        imgs = soup.find_all('meta', property='og:image')
3301
        date_str = soup.find('meta', property='article:published_time')['content'][:10]
3302
        day = string_to_date(date_str, "%Y-%m-%d")
3303
        title = soup.find('meta', property='og:title')['content']
3304
        return {
3305
            'img': [i['content'] for i in imgs],
3306
            'day': day.day,
3307
            'month': day.month,
3308
            'year': day.year,
3309
            'title': title,
3310
        }
3311
3312
@@ 2359-2371 (lines=13) @@
2356
    get_first_comic_link = simulate_first_link
2357
    first_url = 'https://linsedition.com/2011/09/07/l-i-n-s/'
2358
2359
    @classmethod
2360
    def get_comic_info(cls, soup, link):
2361
        """Get information about a particular comics."""
2362
        title = soup.find('meta', property='og:title')['content']
2363
        imgs = soup.find_all('meta', property='og:image')
2364
        date_str = soup.find('meta', property='article:published_time')['content'][:10]
2365
        day = string_to_date(date_str, "%Y-%m-%d")
2366
        return {
2367
            'title': title,
2368
            'img': [i['content'] for i in imgs],
2369
            'month': day.month,
2370
            'year': day.year,
2371
            'day': day.day,
2372
        }
2373
2374