Code Duplication    Length = 18-21 lines in 2 locations

comics.py 2 locations

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