Code Duplication    Length = 13-15 lines in 3 locations

comics.py 3 locations

@@ 3070-3084 (lines=15) @@
3067
        """Get link to first comics."""
3068
        return get_soup_at_url(cls.url).find('li', class_='first').find('a')
3069
3070
    @classmethod
3071
    def get_comic_info(cls, soup, link):
3072
        """Get information about a particular comics."""
3073
        title = soup.find('meta', property='og:title')['content']
3074
        desc = soup.find('meta', property='og:description')['content']
3075
        date_str = soup.find('time')["datetime"]
3076
        day = string_to_date(date_str, "%Y-%m-%d")
3077
        imgs = soup.find('figure').find_all('img')
3078
        return {
3079
            'title': title,
3080
            'description': desc,
3081
            'day': day.day,
3082
            'month': day.month,
3083
            'year': day.year,
3084
            'img': [i['src'] for i in imgs],
3085
        }
3086
3087
@@ 3434-3446 (lines=13) @@
3431
    get_navi_link = get_link_rel_next
3432
    first_url = 'https://marketoonist.com/2002/10/the-8-types-of-brand-managers-2.html'
3433
3434
    @classmethod
3435
    def get_comic_info(cls, soup, link):
3436
        """Get information about a particular comics."""
3437
        imgs = soup.find_all('meta', property='og:image')
3438
        date_str = soup.find('meta', property='article:published_time')['content'][:10]
3439
        day = string_to_date(date_str, "%Y-%m-%d")
3440
        title = soup.find('meta', property='og:title')['content']
3441
        return {
3442
            'img': [i['content'] for i in imgs],
3443
            'day': day.day,
3444
            'month': day.month,
3445
            'year': day.year,
3446
            'title': title,
3447
        }
3448
3449
@@ 2441-2453 (lines=13) @@
2438
    get_first_comic_link = simulate_first_link
2439
    first_url = 'https://linsedition.com/2011/09/07/l-i-n-s/'
2440
2441
    @classmethod
2442
    def get_comic_info(cls, soup, link):
2443
        """Get information about a particular comics."""
2444
        title = soup.find('meta', property='og:title')['content']
2445
        imgs = soup.find_all('meta', property='og:image')
2446
        date_str = soup.find('meta', property='article:published_time')['content'][:10]
2447
        day = string_to_date(date_str, "%Y-%m-%d")
2448
        return {
2449
            'title': title,
2450
            'img': [i['content'] for i in imgs],
2451
            'month': day.month,
2452
            'year': day.year,
2453
            'day': day.day,
2454
        }
2455
2456