Code Duplication    Length = 24-24 lines in 3 locations

comics.py 3 locations

@@ 3391-3414 (lines=24) @@
3388
        """Get link to next or previous comic."""
3389
        return last_soup.find('a', class_='prev-item' if next_ else 'next-item')
3390
3391
    @classmethod
3392
    def get_comic_info(cls, soup, link):
3393
        """Get information about a particular comics."""
3394
        title = soup.find('meta', property='og:title')['content']
3395
        desc = soup.find('meta', property='og:description')['content']
3396
        date_str = soup.find('time', class_='published')['datetime']
3397
        day = string_to_date(date_str, "%Y-%m-%d")
3398
        author = soup.find('a', rel='author').string
3399
        div_content = (soup.find('div', class_="body entry-content") or
3400
                       soup.find('div', class_="special-content"))
3401
        imgs = div_content.find_all('img')
3402
        imgs = [i for i in imgs if i.get('src') is not None]
3403
        assert all('title' not in i or i['alt'] == i['title'] for i in imgs)
3404
        alt = imgs[0].get('alt', "") if imgs else []
3405
        return {
3406
            'title': title,
3407
            'alt': alt,
3408
            'description': desc,
3409
            'author': author,
3410
            'day': day.day,
3411
            'month': day.month,
3412
            'year': day.year,
3413
            'img': [urljoin_wrapper(cls.url, i['src']) for i in imgs],
3414
        }
3415
3416
3417
class GloryOwlComix(GenericNavigableComic):
@@ 3324-3347 (lines=24) @@
3321
    url = 'https://consolia-comic.com'
3322
    get_url_from_link = join_cls_url_to_href
3323
3324
    @classmethod
3325
    def get_first_comic_link(cls):
3326
        """Get link to first comics."""
3327
        return get_soup_at_url(cls.url).find('a', class_='first')
3328
3329
    @classmethod
3330
    def get_navi_link(cls, last_soup, next_):
3331
        """Get link to next or previous comic."""
3332
        return last_soup.find('a', class_='next' if next_ else 'prev')
3333
3334
    @classmethod
3335
    def get_comic_info(cls, soup, link):
3336
        """Get information about a particular comics."""
3337
        title = soup.find('meta', property='og:title')['content']
3338
        date_str = soup.find('time')["datetime"]
3339
        day = string_to_date(date_str, "%Y-%m-%d")
3340
        imgs = soup.find_all('meta', property='og:image')
3341
        return {
3342
            'title': title,
3343
            'img': [i['content'] for i in imgs],
3344
            'day': day.day,
3345
            'month': day.month,
3346
            'year': day.year,
3347
        }
3348
3349
3350
class TuMourrasMoinsBete(GenericNavigableComic):
@@ 3134-3157 (lines=24) @@
3131
3132
3133
class Ubertool(GenericNavigableComic):
3134
    """Class to retrieve Ubertool comics."""
3135
    # Also on http://ubertool.tumblr.com
3136
    # Also on https://tapastic.com/series/ubertool
3137
    name = 'ubertool'
3138
    long_name = 'Ubertool'
3139
    url = 'http://ubertoolcomic.com'
3140
    _categories = ('UBERTOOL', )
3141
    get_first_comic_link = get_a_comicnavbase_comicnavfirst
3142
    get_navi_link = get_a_comicnavbase_comicnavnext
3143
3144
    @classmethod
3145
    def get_comic_info(cls, soup, link):
3146
        """Get information about a particular comics."""
3147
        title = soup.find('h2', class_='post-title').string
3148
        date_str = soup.find('span', class_='post-date').string
3149
        day = string_to_date(date_str, "%B %d, %Y")
3150
        imgs = soup.find('div', id='comic').find_all('img')
3151
        return {
3152
            'img': [i['src'] for i in imgs],
3153
            'title': title,
3154
            'month': day.month,
3155
            'year': day.year,
3156
            'day': day.day,
3157
        }
3158
3159
3160
class EarthExplodes(GenericNavigableComic):