Code Duplication    Length = 29-30 lines in 2 locations

comics.py 2 locations

@@ 3448-3477 (lines=30) @@
3445
        }
3446
3447
3448
class TuMourrasMoinsBete(GenericNavigableComic):
3449
    """Class to retrieve Tu Mourras Moins Bete comics."""
3450
    name = 'mourrasmoinsbete'
3451
    long_name = 'Tu Mourras Moins Bete'
3452
    url = 'http://tumourrasmoinsbete.blogspot.fr'
3453
    _categories = ('FRANCAIS', )
3454
    get_first_comic_link = simulate_first_link
3455
    first_url = 'http://tumourrasmoinsbete.blogspot.fr/2008/06/essai.html'
3456
3457
    @classmethod
3458
    def get_navi_link(cls, last_soup, next_):
3459
        """Get link to next or previous comic."""
3460
        return last_soup.find('a', id='Blog1_blog-pager-newer-link' if next_ else 'Blog1_blog-pager-older-link')
3461
3462
    @classmethod
3463
    def get_comic_info(cls, soup, link):
3464
        """Get information about a particular comics."""
3465
        title = soup.find('title').string
3466
        imgs = soup.find('div', itemprop='description articleBody').find_all('img')
3467
        author = soup.find('span', itemprop='author').string
3468
        return {
3469
            'img': [i['src'] for i in imgs],
3470
            'author': author,
3471
            'title': title,
3472
        }
3473
3474
3475
class GeekAndPoke(GenericNavigableComic):
3476
    """Class to retrieve Geek And Poke comics."""
3477
    name = 'geek'
3478
    long_name = 'Geek And Poke'
3479
    url = 'http://geek-and-poke.com'
3480
    get_url_from_link = join_cls_url_to_href
@@ 3294-3322 (lines=29) @@
3291
3292
3293
class CubeDrone(GenericComicNotWorking, GenericNavigableComic):  # Website has changed
3294
    """Class to retrieve Cube Drone comics."""
3295
    name = 'cubedrone'
3296
    long_name = 'Cube Drone'
3297
    url = 'http://cube-drone.com/comics'
3298
    get_url_from_link = join_cls_url_to_href
3299
3300
    @classmethod
3301
    def get_first_comic_link(cls):
3302
        """Get link to first comics."""
3303
        return get_soup_at_url(cls.url).find('span', class_='glyphicon glyphicon-backward').parent
3304
3305
    @classmethod
3306
    def get_navi_link(cls, last_soup, next_):
3307
        """Get link to next or previous comic."""
3308
        class_ = 'glyphicon glyphicon-chevron-' + ('right' if next_ else 'left')
3309
        return last_soup.find('span', class_=class_).parent
3310
3311
    @classmethod
3312
    def get_comic_info(cls, soup, link):
3313
        """Get information about a particular comics."""
3314
        title = soup.find('meta', attrs={'name': 'twitter:title'})['content']
3315
        url2 = soup.find('meta', attrs={'name': 'twitter:url'})['content']
3316
        # date_str = soup.find('h2', class_='comic_title').find('small').string
3317
        # day = string_to_date(date_str, "%B %d, %Y, %I:%M %p")
3318
        imgs = soup.find_all('img', class_='comic img-responsive')
3319
        title2 = imgs[0]['title']
3320
        alt = imgs[0]['alt']
3321
        return {
3322
            'url2': url2,
3323
            'title': title,
3324
            'title2': title2,
3325
            'alt': alt,