Code Duplication    Length = 18-21 lines in 2 locations

comics.py 2 locations

@@ 2142-2162 (lines=21) @@
2139
        }
2140
2141
2142
class TurnOffUs(GenericListableComic):
2143
    """Class to retrieve TurnOffUs comics."""
2144
    name = 'turnoffus'
2145
    long_name = 'Turn Off Us'
2146
    url = 'http://turnoff.us'
2147
    get_url_from_archive_element = join_cls_url_to_href
2148
2149
    @classmethod
2150
    def get_archive_elements(cls):
2151
        archive_url = urljoin_wrapper(cls.url, 'all')
2152
        post_list = get_soup_at_url(archive_url).find('ul', class_='post-list')
2153
        return reversed(post_list.find_all('a', class_='post-link'))
2154
2155
    @classmethod
2156
    def get_comic_info(cls, soup, archive_elt):
2157
        """Get information about a particular comics."""
2158
        title = soup.find('meta', property='og:title')['content']
2159
        imgs = soup.find_all('meta', property='og:image')
2160
        return {
2161
            'title': title,
2162
            'img': [i['content'] for i in imgs],
2163
        }
2164
2165
@@ 2769-2786 (lines=18) @@
2766
        }
2767
2768
2769
class GenericCommitStrip(GenericNavigableComic):
2770
    """Generic class to retrieve Commit Strips in different languages."""
2771
    get_navi_link = get_a_rel_next
2772
    get_first_comic_link = simulate_first_link
2773
    first_url = NotImplemented
2774
2775
    @classmethod
2776
    def get_comic_info(cls, soup, link):
2777
        """Get information about a particular comics."""
2778
        desc = soup.find('meta', property='og:description')['content']
2779
        title = soup.find('meta', property='og:title')['content']
2780
        imgs = soup.find('div', class_='entry-content').find_all('img')
2781
        title2 = ' '.join(i.get('title', '') for i in imgs)
2782
        return {
2783
            'title': title,
2784
            'title2': title2,
2785
            'description': desc,
2786
            'img': [urljoin_wrapper(cls.url, convert_iri_to_plain_ascii_uri(i['src'])) for i in imgs],
2787
        }
2788
2789