Code Duplication    Length = 18-21 lines in 2 locations

comics.py 2 locations

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