Code Duplication    Length = 24-24 lines in 3 locations

comics.py 3 locations

@@ 3419-3442 (lines=24) @@
3416
        }
3417
3418
3419
class GloryOwlComix(GenericNavigableComic):
3420
    """Class to retrieve Glory Owl comics."""
3421
    name = 'gloryowl'
3422
    long_name = 'Glory Owl'
3423
    url = 'http://gloryowlcomix.blogspot.fr'
3424
    _categories = ('NSFW', 'FRANCAIS')
3425
    get_first_comic_link = simulate_first_link
3426
    first_url = 'http://gloryowlcomix.blogspot.fr/2013/02/1_7.html'
3427
3428
    @classmethod
3429
    def get_navi_link(cls, last_soup, next_):
3430
        """Get link to next or previous comic."""
3431
        return last_soup.find('a', id='Blog1_blog-pager-newer-link' if next_ else 'Blog1_blog-pager-older-link')
3432
3433
    @classmethod
3434
    def get_comic_info(cls, soup, link):
3435
        """Get information about a particular comics."""
3436
        title = soup.find('title').string
3437
        imgs = soup.find_all('link', rel='image_src')
3438
        author = soup.find('a', rel='author').string
3439
        return {
3440
            'img': [i['href'] for i in imgs],
3441
            'author': author,
3442
            'title': title,
3443
        }
3444
3445
@@ 3352-3375 (lines=24) @@
3349
        }
3350
3351
3352
class TuMourrasMoinsBete(GenericNavigableComic):
3353
    """Class to retrieve Tu Mourras Moins Bete comics."""
3354
    name = 'mourrasmoinsbete'
3355
    long_name = 'Tu Mourras Moins Bete'
3356
    url = 'http://tumourrasmoinsbete.blogspot.fr'
3357
    _categories = ('FRANCAIS', )
3358
    get_first_comic_link = simulate_first_link
3359
    first_url = 'http://tumourrasmoinsbete.blogspot.fr/2008/06/essai.html'
3360
3361
    @classmethod
3362
    def get_navi_link(cls, last_soup, next_):
3363
        """Get link to next or previous comic."""
3364
        return last_soup.find('a', id='Blog1_blog-pager-newer-link' if next_ else 'Blog1_blog-pager-older-link')
3365
3366
    @classmethod
3367
    def get_comic_info(cls, soup, link):
3368
        """Get information about a particular comics."""
3369
        title = soup.find('title').string
3370
        imgs = soup.find('div', itemprop='description articleBody').find_all('img')
3371
        author = soup.find('span', itemprop='author').string
3372
        return {
3373
            'img': [i['src'] for i in imgs],
3374
            'author': author,
3375
            'title': title,
3376
        }
3377
3378
@@ 3162-3185 (lines=24) @@
3159
        }
3160
3161
3162
class EarthExplodes(GenericNavigableComic):
3163
    """Class to retrieve The Earth Explodes comics."""
3164
    name = 'earthexplodes'
3165
    long_name = 'The Earth Explodes'
3166
    url = 'http://www.earthexplodes.com'
3167
    get_url_from_link = join_cls_url_to_href
3168
    get_first_comic_link = simulate_first_link
3169
    first_url = 'http://www.earthexplodes.com/comics/000/'
3170
3171
    @classmethod
3172
    def get_navi_link(cls, last_soup, next_):
3173
        """Get link to next or previous comic."""
3174
        return last_soup.find('a', id='next' if next_ else 'prev')
3175
3176
    @classmethod
3177
    def get_comic_info(cls, soup, link):
3178
        """Get information about a particular comics."""
3179
        title = soup.find('title').string
3180
        imgs = soup.find('div', id='image').find_all('img')
3181
        alt = imgs[0].get('title', '')
3182
        return {
3183
            'img': [urljoin_wrapper(cls.url, i['src']) for i in imgs],
3184
            'title': title,
3185
            'alt': alt,
3186
        }
3187
3188