Code Duplication    Length = 18-21 lines in 2 locations

comics.py 2 locations

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