Code Duplication    Length = 18-21 lines in 2 locations

comics.py 2 locations

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