Code Duplication    Length = 24-24 lines in 3 locations

comics.py 3 locations

@@ 3440-3463 (lines=24) @@
3437
        }
3438
3439
3440
class GloryOwlComix(GenericNavigableComic):
3441
    """Class to retrieve Glory Owl comics."""
3442
    name = 'gloryowl'
3443
    long_name = 'Glory Owl'
3444
    url = 'http://gloryowlcomix.blogspot.fr'
3445
    _categories = ('NSFW', 'FRANCAIS')
3446
    get_first_comic_link = simulate_first_link
3447
    first_url = 'http://gloryowlcomix.blogspot.fr/2013/02/1_7.html'
3448
3449
    @classmethod
3450
    def get_navi_link(cls, last_soup, next_):
3451
        """Get link to next or previous comic."""
3452
        return last_soup.find('a', id='Blog1_blog-pager-newer-link' if next_ else 'Blog1_blog-pager-older-link')
3453
3454
    @classmethod
3455
    def get_comic_info(cls, soup, link):
3456
        """Get information about a particular comics."""
3457
        title = soup.find('title').string
3458
        imgs = soup.find_all('link', rel='image_src')
3459
        author = soup.find('a', rel='author').string
3460
        return {
3461
            'img': [i['href'] for i in imgs],
3462
            'author': author,
3463
            'title': title,
3464
        }
3465
3466
@@ 3373-3396 (lines=24) @@
3370
        }
3371
3372
3373
class TuMourrasMoinsBete(GenericNavigableComic):
3374
    """Class to retrieve Tu Mourras Moins Bete comics."""
3375
    name = 'mourrasmoinsbete'
3376
    long_name = 'Tu Mourras Moins Bete'
3377
    url = 'http://tumourrasmoinsbete.blogspot.fr'
3378
    _categories = ('FRANCAIS', )
3379
    get_first_comic_link = simulate_first_link
3380
    first_url = 'http://tumourrasmoinsbete.blogspot.fr/2008/06/essai.html'
3381
3382
    @classmethod
3383
    def get_navi_link(cls, last_soup, next_):
3384
        """Get link to next or previous comic."""
3385
        return last_soup.find('a', id='Blog1_blog-pager-newer-link' if next_ else 'Blog1_blog-pager-older-link')
3386
3387
    @classmethod
3388
    def get_comic_info(cls, soup, link):
3389
        """Get information about a particular comics."""
3390
        title = soup.find('title').string
3391
        imgs = soup.find('div', itemprop='description articleBody').find_all('img')
3392
        author = soup.find('span', itemprop='author').string
3393
        return {
3394
            'img': [i['src'] for i in imgs],
3395
            'author': author,
3396
            'title': title,
3397
        }
3398
3399
@@ 3183-3206 (lines=24) @@
3180
        }
3181
3182
3183
class EarthExplodes(GenericNavigableComic):
3184
    """Class to retrieve The Earth Explodes comics."""
3185
    name = 'earthexplodes'
3186
    long_name = 'The Earth Explodes'
3187
    url = 'http://www.earthexplodes.com'
3188
    get_url_from_link = join_cls_url_to_href
3189
    get_first_comic_link = simulate_first_link
3190
    first_url = 'http://www.earthexplodes.com/comics/000/'
3191
3192
    @classmethod
3193
    def get_navi_link(cls, last_soup, next_):
3194
        """Get link to next or previous comic."""
3195
        return last_soup.find('a', id='next' if next_ else 'prev')
3196
3197
    @classmethod
3198
    def get_comic_info(cls, soup, link):
3199
        """Get information about a particular comics."""
3200
        title = soup.find('title').string
3201
        imgs = soup.find('div', id='image').find_all('img')
3202
        alt = imgs[0].get('title', '')
3203
        return {
3204
            'img': [urljoin_wrapper(cls.url, i['src']) for i in imgs],
3205
            'title': title,
3206
            'alt': alt,
3207
        }
3208
3209