Code Duplication    Length = 29-30 lines in 2 locations

comics.py 2 locations

@@ 3380-3409 (lines=30) @@
3377
        }
3378
3379
3380
class ConsoliaComics(GenericNavigableComic):
3381
    """Class to retrieve Consolia comics."""
3382
    name = 'consolia'
3383
    long_name = 'consolia'
3384
    url = 'https://consolia-comic.com'
3385
    get_url_from_link = join_cls_url_to_href
3386
3387
    @classmethod
3388
    def get_first_comic_link(cls):
3389
        """Get link to first comics."""
3390
        return get_soup_at_url(cls.url).find('a', class_='first')
3391
3392
    @classmethod
3393
    def get_navi_link(cls, last_soup, next_):
3394
        """Get link to next or previous comic."""
3395
        return last_soup.find('a', class_='next' if next_ else 'prev')
3396
3397
    @classmethod
3398
    def get_comic_info(cls, soup, link):
3399
        """Get information about a particular comics."""
3400
        title = soup.find('meta', property='og:title')['content']
3401
        date_str = soup.find('time')["datetime"]
3402
        day = string_to_date(date_str, "%Y-%m-%d")
3403
        imgs = soup.find_all('meta', property='og:image')
3404
        return {
3405
            'title': title,
3406
            'img': [i['content'] for i in imgs],
3407
            'day': day.day,
3408
            'month': day.month,
3409
            'year': day.year,
3410
        }
3411
3412
@@ 3227-3255 (lines=29) @@
3224
        }
3225
3226
3227
class PomComics(GenericNavigableComic):
3228
    """Class to retrieve PomComics."""
3229
    name = 'pom'
3230
    long_name = 'Pom Comics / Piece of Me'
3231
    url = 'http://www.pomcomic.com'
3232
    get_url_from_link = join_cls_url_to_href
3233
3234
    @classmethod
3235
    def get_first_comic_link(cls):
3236
        """Get link to first comics."""
3237
        return get_soup_at_url(cls.url).find('a', class_='btn-first')
3238
3239
    @classmethod
3240
    def get_navi_link(cls, last_soup, next_):
3241
        """Get link to next or previous comic."""
3242
        return last_soup.find('a', class_='btn-next' if next_ else 'btn-prev')
3243
3244
    @classmethod
3245
    def get_comic_info(cls, soup, link):
3246
        """Get information about a particular comics."""
3247
        title = soup.find('h1').string
3248
        desc = soup.find('meta', property='og:description')['content']
3249
        tags = soup.find('meta', attrs={'name': 'keywords'})['content']
3250
        imgs = soup.find('div', class_='comic').find_all('img')
3251
        return {
3252
            'title': title,
3253
            'desc': desc,
3254
            'tags': tags,
3255
            'img': [urljoin_wrapper(cls.url, i['src']) for i in imgs],
3256
        }
3257
3258