Code Duplication    Length = 29-30 lines in 2 locations

comics.py 2 locations

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