Code Duplication    Length = 18-21 lines in 2 locations

comics.py 2 locations

@@ 2220-2240 (lines=21) @@
2217
        }
2218
2219
2220
class TurnOffUs(GenericListableComic):
2221
    """Class to retrieve TurnOffUs comics."""
2222
    name = 'turnoffus'
2223
    long_name = 'Turn Off Us'
2224
    url = 'http://turnoff.us'
2225
    get_url_from_archive_element = join_cls_url_to_href
2226
2227
    @classmethod
2228
    def get_archive_elements(cls):
2229
        archive_url = urljoin_wrapper(cls.url, 'all')
2230
        post_list = get_soup_at_url(archive_url).find('ul', class_='post-list')
2231
        return reversed(post_list.find_all('a', class_='post-link'))
2232
2233
    @classmethod
2234
    def get_comic_info(cls, soup, archive_elt):
2235
        """Get information about a particular comics."""
2236
        title = soup.find('meta', property='og:title')['content']
2237
        imgs = soup.find_all('meta', property='og:image')
2238
        return {
2239
            'title': title,
2240
            'img': [i['content'] for i in imgs],
2241
        }
2242
2243
@@ 2909-2926 (lines=18) @@
2906
        }
2907
2908
2909
class GenericCommitStrip(GenericNavigableComic):
2910
    """Generic class to retrieve Commit Strips in different languages."""
2911
    get_navi_link = get_a_rel_next
2912
    get_first_comic_link = simulate_first_link
2913
    first_url = NotImplemented
2914
2915
    @classmethod
2916
    def get_comic_info(cls, soup, link):
2917
        """Get information about a particular comics."""
2918
        desc = soup.find('meta', property='og:description')['content']
2919
        title = soup.find('meta', property='og:title')['content']
2920
        imgs = soup.find('div', class_='entry-content').find_all('img')
2921
        title2 = ' '.join(i.get('title', '') for i in imgs)
2922
        return {
2923
            'title': title,
2924
            'title2': title2,
2925
            'description': desc,
2926
            'img': [urljoin_wrapper(cls.url, convert_iri_to_plain_ascii_uri(i['src'])) for i in imgs],
2927
        }
2928
2929