Code Duplication    Length = 12-15 lines in 3 locations

comics.py 3 locations

@@ 4184-4198 (lines=15) @@
4181
                            for s in cls.img_re.match(imgs[0]['src']).groups()]
4182
        return {
4183
            'title': title,
4184
            'day': day,
4185
            'month': month,
4186
            'year': year,
4187
            'img': [i['src'] for i in imgs],
4188
            'num': num,
4189
        }
4190
4191
    @classmethod
4192
    def get_archive_elements(cls):
4193
        archive_url = 'http://www.horovitzcomics.com/comics/archive/'
4194
        return reversed(get_soup_at_url(archive_url).find_all('a', href=cls.link_re))
4195
4196
4197
class HorovitzNew(HorovitzComics):
4198
    """Class to retrieve Horovitz new comics."""
4199
    name = 'horovitznew'
4200
    long_name = 'Horovitz New'
4201
    link_re = re.compile('^/comics/new/([0-9]+)$')
@@ 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
        }