Code Duplication    Length = 12-15 lines in 3 locations

comics.py 3 locations

@@ 4319-4333 (lines=15) @@
4316
    @classmethod
4317
    def get_navi_link(cls, last_soup, next_):
4318
        """Get link to next or previous comic."""
4319
        PREV = 'fa btn btn-outline-default btn-circle fa-caret-left sm '
4320
        NEXT = 'fa btn btn-outline-default btn-circle fa-caret-right sm '
4321
        return last_soup.find('a', class_=NEXT if next_ else PREV)
4322
4323
    @classmethod
4324
    def get_url_from_link(cls, link):
4325
        gocomics = 'http://www.gocomics.com'
4326
        return urljoin_wrapper(gocomics, link['href'])
4327
4328
    @classmethod
4329
    def get_comic_info(cls, soup, link):
4330
        """Get information about a particular comics."""
4331
        date_str = soup.find('meta', property='article:published_time')['content']
4332
        day = string_to_date(date_str, "%Y-%m-%d")
4333
        imgs = soup.find('picture', class_='img-fluid item-comic-image').find_all('img')
4334
        author = soup.find('meta', property='article:author')['content']
4335
        tags = soup.find('meta', property='article:tag')['content']
4336
        return {
@@ 3003-3015 (lines=13) @@
3000
        """Get link to first comics."""
3001
        return get_soup_at_url(cls.url).find('a', class_='webcomic-link webcomic1-link first-webcomic-link first-webcomic1-link')
3002
3003
    @classmethod
3004
    def get_comic_info(cls, soup, link):
3005
        """Get information about a particular comics."""
3006
        title = soup.find('meta', property='og:title')['content']
3007
        imgs = soup.find('div', class_='webcomic-image').find_all('img')
3008
        date_str = soup.find('meta', property='article:published_time')['content'][:10]
3009
        day = string_to_date(date_str, "%Y-%m-%d")
3010
        return {
3011
            'title': title,
3012
            'day': day.day,
3013
            'month': day.month,
3014
            'year': day.year,
3015
            'img': [i['src'] for i in imgs],
3016
        }
3017
3018
@@ 2707-2718 (lines=12) @@
2704
    get_first_comic_link = simulate_first_link
2705
    first_url = NotImplemented
2706
2707
    @classmethod
2708
    def get_comic_info(cls, soup, link):
2709
        """Get information about a particular comics."""
2710
        desc = soup.find('meta', property='og:description')['content']
2711
        title = soup.find('meta', property='og:title')['content']
2712
        imgs = soup.find('div', class_='entry-content').find_all('img')
2713
        title2 = ' '.join(i.get('title', '') for i in imgs)
2714
        return {
2715
            'title': title,
2716
            'title2': title2,
2717
            'description': desc,
2718
            'img': [urljoin_wrapper(cls.url, convert_iri_to_plain_ascii_uri(i['src'])) for i in imgs],
2719
        }
2720
2721