Code Duplication    Length = 18-21 lines in 2 locations

comics.py 2 locations

@@ 2147-2167 (lines=21) @@
2144
        return {
2145
            'title': title,
2146
            'img': [i['content'] for i in imgs],
2147
        }
2148
2149
2150
class TurnOffUs(GenericListableComic):
2151
    """Class to retrieve TurnOffUs comics."""
2152
    name = 'turnoffus'
2153
    long_name = 'Turn Off Us'
2154
    url = 'http://turnoff.us'
2155
    get_url_from_archive_element = join_cls_url_to_href
2156
2157
    @classmethod
2158
    def get_archive_elements(cls):
2159
        archive_url = urljoin_wrapper(cls.url, 'all')
2160
        post_list = get_soup_at_url(archive_url).find('ul', class_='post-list')
2161
        return reversed(post_list.find_all('a', class_='post-link'))
2162
2163
    @classmethod
2164
    def get_comic_info(cls, soup, archive_elt):
2165
        """Get information about a particular comics."""
2166
        title = soup.find('meta', property='og:title')['content']
2167
        imgs = soup.find_all('meta', property='og:image')
2168
        return {
2169
            'title': title,
2170
            'img': [i['content'] for i in imgs],
@@ 2747-2764 (lines=18) @@
2744
        return {
2745
            'img': [i['src'] for i in imgs],
2746
            'title': imgs[0]['title'],
2747
        }
2748
2749
2750
class GenericCommitStrip(GenericNavigableComic):
2751
    """Generic class to retrieve Commit Strips in different languages."""
2752
    get_navi_link = get_a_rel_next
2753
    get_first_comic_link = simulate_first_link
2754
    first_url = NotImplemented
2755
2756
    @classmethod
2757
    def get_comic_info(cls, soup, link):
2758
        """Get information about a particular comics."""
2759
        desc = soup.find('meta', property='og:description')['content']
2760
        title = soup.find('meta', property='og:title')['content']
2761
        imgs = soup.find('div', class_='entry-content').find_all('img')
2762
        title2 = ' '.join(i.get('title', '') for i in imgs)
2763
        return {
2764
            'title': title,
2765
            'title2': title2,
2766
            'description': desc,
2767
            'img': [urljoin_wrapper(cls.url, convert_iri_to_plain_ascii_uri(i['src'])) for i in imgs],