Code Duplication    Length = 29-30 lines in 2 locations

comics.py 2 locations

@@ 3319-3348 (lines=30) @@
3316
        }
3317
3318
3319
class ConsoliaComics(GenericNavigableComic):
3320
    """Class to retrieve Consolia comics."""
3321
    name = 'consolia'
3322
    long_name = 'consolia'
3323
    url = 'https://consolia-comic.com'
3324
    get_url_from_link = join_cls_url_to_href
3325
3326
    @classmethod
3327
    def get_first_comic_link(cls):
3328
        """Get link to first comics."""
3329
        return get_soup_at_url(cls.url).find('a', class_='first')
3330
3331
    @classmethod
3332
    def get_navi_link(cls, last_soup, next_):
3333
        """Get link to next or previous comic."""
3334
        return last_soup.find('a', class_='next' if next_ else 'prev')
3335
3336
    @classmethod
3337
    def get_comic_info(cls, soup, link):
3338
        """Get information about a particular comics."""
3339
        title = soup.find('meta', property='og:title')['content']
3340
        date_str = soup.find('time')["datetime"]
3341
        day = string_to_date(date_str, "%Y-%m-%d")
3342
        imgs = soup.find_all('meta', property='og:image')
3343
        return {
3344
            'title': title,
3345
            'img': [i['content'] for i in imgs],
3346
            'day': day.day,
3347
            'month': day.month,
3348
            'year': day.year,
3349
        }
3350
3351
@@ 3189-3217 (lines=29) @@
3186
        }
3187
3188
3189
class PomComics(GenericNavigableComic):
3190
    """Class to retrieve PomComics."""
3191
    name = 'pom'
3192
    long_name = 'Pom Comics / Piece of Me'
3193
    url = 'http://www.pomcomic.com'
3194
    get_url_from_link = join_cls_url_to_href
3195
3196
    @classmethod
3197
    def get_first_comic_link(cls):
3198
        """Get link to first comics."""
3199
        return get_soup_at_url(cls.url).find('a', class_='btn_first')
3200
3201
    @classmethod
3202
    def get_navi_link(cls, last_soup, next_):
3203
        """Get link to next or previous comic."""
3204
        return last_soup.find('a', class_='btn_next' if next_ else 'btn_prev')
3205
3206
    @classmethod
3207
    def get_comic_info(cls, soup, link):
3208
        """Get information about a particular comics."""
3209
        title = soup.find('h1', id="comic-name").string
3210
        desc = soup.find('meta', property='og:description')['content']
3211
        tags = soup.find('meta', attrs={'name': 'keywords'})['content']
3212
        imgs = soup.find('div', class_='comic').find_all('img')
3213
        return {
3214
            'title': title,
3215
            'desc': desc,
3216
            'tags': tags,
3217
            'img': [urljoin_wrapper(cls.url, i['src']) for i in imgs],
3218
        }
3219
3220