Code Duplication    Length = 18-21 lines in 2 locations

comics.py 2 locations

@@ 2193-2213 (lines=21) @@
2190
        return {
2191
            'title': title,
2192
            'img': [i['content'] for i in imgs],
2193
        }
2194
2195
2196
class TurnOffUs(GenericListableComic):
2197
    """Class to retrieve TurnOffUs comics."""
2198
    name = 'turnoffus'
2199
    long_name = 'Turn Off Us'
2200
    url = 'http://turnoff.us'
2201
    get_url_from_archive_element = join_cls_url_to_href
2202
2203
    @classmethod
2204
    def get_archive_elements(cls):
2205
        archive_url = urljoin_wrapper(cls.url, 'all')
2206
        post_list = get_soup_at_url(archive_url).find('ul', class_='post-list')
2207
        return reversed(post_list.find_all('a', class_='post-link'))
2208
2209
    @classmethod
2210
    def get_comic_info(cls, soup, archive_elt):
2211
        """Get information about a particular comics."""
2212
        title = soup.find('meta', property='og:title')['content']
2213
        imgs = soup.find_all('meta', property='og:image')
2214
        return {
2215
            'title': title,
2216
            'img': [i['content'] for i in imgs],
@@ 2845-2862 (lines=18) @@
2842
    get_navi_link = get_link_rel_next
2843
2844
    @classmethod
2845
    def get_comic_info(cls, soup, link):
2846
        """Get information about a particular comics."""
2847
        imgs = soup.find('div', id='comic').find_all('img')
2848
        assert all(i['alt'] == i['title'] for i in imgs)
2849
        assert len(imgs) == 1, imgs
2850
        return {
2851
            'img': [i['src'] for i in imgs],
2852
            'title': imgs[0]['title'],
2853
        }
2854
2855
2856
class GenericCommitStrip(GenericNavigableComic):
2857
    """Generic class to retrieve Commit Strips in different languages."""
2858
    get_navi_link = get_a_rel_next
2859
    get_first_comic_link = simulate_first_link
2860
    first_url = NotImplemented
2861
2862
    @classmethod
2863
    def get_comic_info(cls, soup, link):
2864
        """Get information about a particular comics."""
2865
        desc = soup.find('meta', property='og:description')['content']