Code Duplication    Length = 18-21 lines in 2 locations

comics.py 2 locations

@@ 2197-2217 (lines=21) @@
2194
class TurnOffUs(GenericListableComic):
2195
    """Class to retrieve TurnOffUs comics."""
2196
    name = 'turnoffus'
2197
    long_name = 'Turn Off Us'
2198
    url = 'http://turnoff.us'
2199
    get_url_from_archive_element = join_cls_url_to_href
2200
2201
    @classmethod
2202
    def get_archive_elements(cls):
2203
        archive_url = urljoin_wrapper(cls.url, 'all')
2204
        post_list = get_soup_at_url(archive_url).find('ul', class_='post-list')
2205
        return reversed(post_list.find_all('a', class_='post-link'))
2206
2207
    @classmethod
2208
    def get_comic_info(cls, soup, archive_elt):
2209
        """Get information about a particular comics."""
2210
        title = soup.find('meta', property='og:title')['content']
2211
        imgs = soup.find_all('meta', property='og:image')
2212
        return {
2213
            'title': title,
2214
            'img': [i['content'] for i in imgs],
2215
        }
2216
2217
2218
class ThingsInSquares(GenericListableComic):
2219
    """Class to retrieve Things In Squares comics."""
2220
    # This can be retrieved in other languages
@@ 2857-2874 (lines=18) @@
2854
            'title': title,
2855
            'img': [i['src'] for i in imgs],
2856
            'month': day.month,
2857
            'year': day.year,
2858
            'day': day.day,
2859
        }
2860
2861
2862
class BuniComic(GenericNavigableComic):
2863
    """Class to retrieve Buni Comics."""
2864
    name = 'buni'
2865
    long_name = 'BuniComics'
2866
    url = 'http://www.bunicomic.com'
2867
    get_first_comic_link = get_a_comicnavbase_comicnavfirst
2868
    get_navi_link = get_link_rel_next
2869
2870
    @classmethod
2871
    def get_comic_info(cls, soup, link):
2872
        """Get information about a particular comics."""
2873
        imgs = soup.find('div', id='comic').find_all('img')
2874
        assert all(i['alt'] == i['title'] for i in imgs)
2875
        assert len(imgs) == 1, imgs
2876
        return {
2877
            'img': [i['src'] for i in imgs],