Code Duplication    Length = 24-24 lines in 3 locations

comics.py 3 locations

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