Code Duplication    Length = 18-21 lines in 2 locations

comics.py 2 locations

@@ 2197-2217 (lines=21) @@
2194
class TurnOffUs(GenericListableComic):
2195
    """Class to retrieve TurnOffUs comics."""
2196
    name = 'turnoffus'
2197
    long_name = 'Turn Off Us'
2198
    url = 'http://turnoff.us'
2199
    get_url_from_archive_element = join_cls_url_to_href
2200
2201
    @classmethod
2202
    def get_archive_elements(cls):
2203
        archive_url = urljoin_wrapper(cls.url, 'all')
2204
        post_list = get_soup_at_url(archive_url).find('ul', class_='post-list')
2205
        return reversed(post_list.find_all('a', class_='post-link'))
2206
2207
    @classmethod
2208
    def get_comic_info(cls, soup, archive_elt):
2209
        """Get information about a particular comics."""
2210
        title = soup.find('meta', property='og:title')['content']
2211
        imgs = soup.find_all('meta', property='og:image')
2212
        return {
2213
            'title': title,
2214
            'img': [i['content'] for i in imgs],
2215
        }
2216
2217
2218
class ThingsInSquares(GenericListableComic):
2219
    """Class to retrieve Things In Squares comics."""
2220
    # This can be retrieved in other languages
@@ 2857-2874 (lines=18) @@
2854
class GenericCommitStrip(GenericNavigableComic):
2855
    """Generic class to retrieve Commit Strips in different languages."""
2856
    get_navi_link = get_a_rel_next
2857
    get_first_comic_link = simulate_first_link
2858
    first_url = NotImplemented
2859
2860
    @classmethod
2861
    def get_comic_info(cls, soup, link):
2862
        """Get information about a particular comics."""
2863
        desc = soup.find('meta', property='og:description')['content']
2864
        title = soup.find('meta', property='og:title')['content']
2865
        imgs = soup.find('div', class_='entry-content').find_all('img')
2866
        title2 = ' '.join(i.get('title', '') for i in imgs)
2867
        return {
2868
            'title': title,
2869
            'title2': title2,
2870
            'description': desc,
2871
            'img': [urljoin_wrapper(cls.url, convert_iri_to_plain_ascii_uri(i['src'])) for i in imgs],
2872
        }
2873
2874
2875
class CommitStripFr(GenericCommitStrip):
2876
    """Class to retrieve Commit Strips in French."""
2877
    name = 'commit_fr'