Code Duplication    Length = 24-24 lines in 3 locations

comics.py 3 locations

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