Code Duplication    Length = 29-30 lines in 2 locations

comics.py 2 locations

@@ 3291-3320 (lines=30) @@
3288
    """Class to retrieve Consolia comics."""
3289
    name = 'consolia'
3290
    long_name = 'consolia'
3291
    url = 'https://consolia-comic.com'
3292
    get_url_from_link = join_cls_url_to_href
3293
3294
    @classmethod
3295
    def get_first_comic_link(cls):
3296
        """Get link to first comics."""
3297
        return get_soup_at_url(cls.url).find('a', class_='first')
3298
3299
    @classmethod
3300
    def get_navi_link(cls, last_soup, next_):
3301
        """Get link to next or previous comic."""
3302
        return last_soup.find('a', class_='next' if next_ else 'prev')
3303
3304
    @classmethod
3305
    def get_comic_info(cls, soup, link):
3306
        """Get information about a particular comics."""
3307
        title = soup.find('meta', property='og:title')['content']
3308
        date_str = soup.find('time')["datetime"]
3309
        day = string_to_date(date_str, "%Y-%m-%d")
3310
        imgs = soup.find_all('meta', property='og:image')
3311
        return {
3312
            'title': title,
3313
            'img': [i['content'] for i in imgs],
3314
            'day': day.day,
3315
            'month': day.month,
3316
            'year': day.year,
3317
        }
3318
3319
3320
class TuMourrasMoinsBete(GenericNavigableComic):
3321
    """Class to retrieve Tu Mourras Moins Bete comics."""
3322
    name = 'mourrasmoinsbete'
3323
    long_name = 'Tu Mourras Moins Bete'
@@ 3161-3189 (lines=29) @@
3158
    """Class to retrieve PomComics."""
3159
    name = 'pom'
3160
    long_name = 'Pom Comics / Piece of Me'
3161
    url = 'http://www.pomcomic.com'
3162
    get_url_from_link = join_cls_url_to_href
3163
3164
    @classmethod
3165
    def get_first_comic_link(cls):
3166
        """Get link to first comics."""
3167
        return get_soup_at_url(cls.url).find('a', class_='btn_first')
3168
3169
    @classmethod
3170
    def get_navi_link(cls, last_soup, next_):
3171
        """Get link to next or previous comic."""
3172
        return last_soup.find('a', class_='btn_next' if next_ else 'btn_prev')
3173
3174
    @classmethod
3175
    def get_comic_info(cls, soup, link):
3176
        """Get information about a particular comics."""
3177
        title = soup.find('h1', id="comic-name").string
3178
        desc = soup.find('meta', property='og:description')['content']
3179
        tags = soup.find('meta', attrs={'name': 'keywords'})['content']
3180
        imgs = soup.find('div', class_='comic').find_all('img')
3181
        return {
3182
            'title': title,
3183
            'desc': desc,
3184
            'tags': tags,
3185
            'img': [urljoin_wrapper(cls.url, i['src']) for i in imgs],
3186
        }
3187
3188
3189
class CubeDrone(GenericNavigableComic):
3190
    """Class to retrieve Cube Drone comics."""
3191
    name = 'cubedrone'
3192
    long_name = 'Cube Drone'