Code Duplication    Length = 12-15 lines in 3 locations

comics.py 3 locations

@@ 4184-4198 (lines=15) @@
4181
4182
    @classmethod
4183
    def get_navi_link(cls, last_soup, next_):
4184
        """Get link to next or previous comic."""
4185
        PREV = 'fa btn btn-outline-default btn-circle fa-caret-left sm '
4186
        NEXT = 'fa btn btn-outline-default btn-circle fa-caret-right sm '
4187
        return last_soup.find('a', class_=NEXT if next_ else PREV)
4188
4189
    @classmethod
4190
    def get_url_from_link(cls, link):
4191
        gocomics = 'http://www.gocomics.com'
4192
        return urljoin_wrapper(gocomics, link['href'])
4193
4194
    @classmethod
4195
    def get_comic_info(cls, soup, link):
4196
        """Get information about a particular comics."""
4197
        date_str = soup.find('meta', property='article:published_time')['content']
4198
        day = string_to_date(date_str, "%Y-%m-%d")
4199
        imgs = soup.find('picture', class_='img-fluid item-comic-image').find_all('img')
4200
        author = soup.find('meta', property='article:author')['content']
4201
        tags = soup.find('meta', property='article:tag')['content']
@@ 2952-2964 (lines=13) @@
2949
    @classmethod
2950
    def get_first_comic_link(cls):
2951
        """Get link to first comics."""
2952
        return get_soup_at_url(cls.url).find('a', class_='webcomic-link webcomic1-link first-webcomic-link first-webcomic1-link')
2953
2954
    @classmethod
2955
    def get_comic_info(cls, soup, link):
2956
        """Get information about a particular comics."""
2957
        title = soup.find('meta', property='og:title')['content']
2958
        imgs = soup.find('div', class_='webcomic-image').find_all('img')
2959
        date_str = soup.find('meta', property='article:published_time')['content'][:10]
2960
        day = string_to_date(date_str, "%Y-%m-%d")
2961
        return {
2962
            'title': title,
2963
            'day': day.day,
2964
            'month': day.month,
2965
            'year': day.year,
2966
            'img': [i['src'] for i in imgs],
2967
        }
@@ 2656-2667 (lines=12) @@
2653
    """Generic class to retrieve Commit Strips in different languages."""
2654
    get_navi_link = get_a_rel_next
2655
    get_first_comic_link = simulate_first_link
2656
    first_url = NotImplemented
2657
2658
    @classmethod
2659
    def get_comic_info(cls, soup, link):
2660
        """Get information about a particular comics."""
2661
        desc = soup.find('meta', property='og:description')['content']
2662
        title = soup.find('meta', property='og:title')['content']
2663
        imgs = soup.find('div', class_='entry-content').find_all('img')
2664
        title2 = ' '.join(i.get('title', '') for i in imgs)
2665
        return {
2666
            'title': title,
2667
            'title2': title2,
2668
            'description': desc,
2669
            'img': [urljoin_wrapper(cls.url, convert_iri_to_plain_ascii_uri(i['src'])) for i in imgs],
2670
        }