Code Duplication    Length = 24-24 lines in 3 locations

comics.py 3 locations

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