Code Duplication    Length = 18-21 lines in 2 locations

comics.py 2 locations

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