Code Duplication    Length = 24-24 lines in 3 locations

comics.py 3 locations

@@ 3391-3414 (lines=24) @@
3388
        }
3389
3390
3391
class GloryOwlComix(GenericNavigableComic):
3392
    """Class to retrieve Glory Owl comics."""
3393
    name = 'gloryowl'
3394
    long_name = 'Glory Owl'
3395
    url = 'http://gloryowlcomix.blogspot.fr'
3396
    _categories = ('NSFW', 'FRANCAIS')
3397
    get_first_comic_link = simulate_first_link
3398
    first_url = 'http://gloryowlcomix.blogspot.fr/2013/02/1_7.html'
3399
3400
    @classmethod
3401
    def get_navi_link(cls, last_soup, next_):
3402
        """Get link to next or previous comic."""
3403
        return last_soup.find('a', id='Blog1_blog-pager-newer-link' if next_ else 'Blog1_blog-pager-older-link')
3404
3405
    @classmethod
3406
    def get_comic_info(cls, soup, link):
3407
        """Get information about a particular comics."""
3408
        title = soup.find('title').string
3409
        imgs = soup.find_all('link', rel='image_src')
3410
        author = soup.find('a', rel='author').string
3411
        return {
3412
            'img': [i['href'] for i in imgs],
3413
            'author': author,
3414
            'title': title,
3415
        }
3416
3417
@@ 3324-3347 (lines=24) @@
3321
        }
3322
3323
3324
class TuMourrasMoinsBete(GenericNavigableComic):
3325
    """Class to retrieve Tu Mourras Moins Bete comics."""
3326
    name = 'mourrasmoinsbete'
3327
    long_name = 'Tu Mourras Moins Bete'
3328
    url = 'http://tumourrasmoinsbete.blogspot.fr'
3329
    _categories = ('FRANCAIS', )
3330
    get_first_comic_link = simulate_first_link
3331
    first_url = 'http://tumourrasmoinsbete.blogspot.fr/2008/06/essai.html'
3332
3333
    @classmethod
3334
    def get_navi_link(cls, last_soup, next_):
3335
        """Get link to next or previous comic."""
3336
        return last_soup.find('a', id='Blog1_blog-pager-newer-link' if next_ else 'Blog1_blog-pager-older-link')
3337
3338
    @classmethod
3339
    def get_comic_info(cls, soup, link):
3340
        """Get information about a particular comics."""
3341
        title = soup.find('title').string
3342
        imgs = soup.find('div', itemprop='description articleBody').find_all('img')
3343
        author = soup.find('span', itemprop='author').string
3344
        return {
3345
            'img': [i['src'] for i in imgs],
3346
            'author': author,
3347
            'title': title,
3348
        }
3349
3350
@@ 3134-3157 (lines=24) @@
3131
        }
3132
3133
3134
class EarthExplodes(GenericNavigableComic):
3135
    """Class to retrieve The Earth Explodes comics."""
3136
    name = 'earthexplodes'
3137
    long_name = 'The Earth Explodes'
3138
    url = 'http://www.earthexplodes.com'
3139
    get_url_from_link = join_cls_url_to_href
3140
    get_first_comic_link = simulate_first_link
3141
    first_url = 'http://www.earthexplodes.com/comics/000/'
3142
3143
    @classmethod
3144
    def get_navi_link(cls, last_soup, next_):
3145
        """Get link to next or previous comic."""
3146
        return last_soup.find('a', id='next' if next_ else 'prev')
3147
3148
    @classmethod
3149
    def get_comic_info(cls, soup, link):
3150
        """Get information about a particular comics."""
3151
        title = soup.find('title').string
3152
        imgs = soup.find('div', id='image').find_all('img')
3153
        alt = imgs[0].get('title', '')
3154
        return {
3155
            'img': [urljoin_wrapper(cls.url, i['src']) for i in imgs],
3156
            'title': title,
3157
            'alt': alt,
3158
        }
3159
3160