Code Duplication    Length = 18-21 lines in 2 locations

comics.py 2 locations

@@ 2177-2197 (lines=21) @@
2174
        }
2175
2176
2177
class TurnOffUs(GenericListableComic):
2178
    """Class to retrieve TurnOffUs comics."""
2179
    name = 'turnoffus'
2180
    long_name = 'Turn Off Us'
2181
    url = 'http://turnoff.us'
2182
    get_url_from_archive_element = join_cls_url_to_href
2183
2184
    @classmethod
2185
    def get_archive_elements(cls):
2186
        archive_url = urljoin_wrapper(cls.url, 'all')
2187
        post_list = get_soup_at_url(archive_url).find('ul', class_='post-list')
2188
        return reversed(post_list.find_all('a', class_='post-link'))
2189
2190
    @classmethod
2191
    def get_comic_info(cls, soup, archive_elt):
2192
        """Get information about a particular comics."""
2193
        title = soup.find('meta', property='og:title')['content']
2194
        imgs = soup.find_all('meta', property='og:image')
2195
        return {
2196
            'title': title,
2197
            'img': [i['content'] for i in imgs],
2198
        }
2199
2200
@@ 2805-2822 (lines=18) @@
2802
        }
2803
2804
2805
class GenericCommitStrip(GenericNavigableComic):
2806
    """Generic class to retrieve Commit Strips in different languages."""
2807
    get_navi_link = get_a_rel_next
2808
    get_first_comic_link = simulate_first_link
2809
    first_url = NotImplemented
2810
2811
    @classmethod
2812
    def get_comic_info(cls, soup, link):
2813
        """Get information about a particular comics."""
2814
        desc = soup.find('meta', property='og:description')['content']
2815
        title = soup.find('meta', property='og:title')['content']
2816
        imgs = soup.find('div', class_='entry-content').find_all('img')
2817
        title2 = ' '.join(i.get('title', '') for i in imgs)
2818
        return {
2819
            'title': title,
2820
            'title2': title2,
2821
            'description': desc,
2822
            'img': [urljoin_wrapper(cls.url, convert_iri_to_plain_ascii_uri(i['src'])) for i in imgs],
2823
        }
2824
2825