Code Duplication    Length = 22-29 lines in 2 locations

comics.py 2 locations

@@ 324-352 (lines=29) @@
321
        }
322
323
324
class GenericLeMondeBlog(GenericNavigableComic):
325
    """Generic class to retrieve comics from Le Monde blogs."""
326
    get_navi_link = get_link_rel_next
327
328
    @classmethod
329
    def get_first_comic_url(cls):
330
        """Get first comic url."""
331
        raise NotImplementedError
332
333
    @classmethod
334
    def get_first_comic_link(cls):
335
        """Get link to first comics."""
336
        return {'href': cls.get_first_comic_url()}
337
338
    @classmethod
339
    def get_comic_info(cls, soup, link):
340
        """Get information about a particular comics."""
341
        url2 = soup.find('link', rel='shortlink')['href']
342
        title = soup.find('meta', property='og:title')['content']
343
        date_str = soup.find("span", class_="entry-date").string
344
        day = string_to_date(date_str, "%d %B %Y", "fr_FR.utf8")
345
        imgs = soup.find_all('meta', property='og:image')
346
        return {
347
            'title': title,
348
            'url2': url2,
349
            'img': [convert_iri_to_plain_ascii_uri(i['content']) for i in imgs],
350
            'month': day.month,
351
            'year': day.year,
352
            'day': day.day,
353
        }
354
355
@@ 2938-2959 (lines=22) @@
2935
            'description': desc,
2936
            'author': author,
2937
            'day': day.day,
2938
            'month': day.month,
2939
            'year': day.year,
2940
            'img': [i['src'] for i in imgs],
2941
        }
2942
2943
2944
class GenericWordPressInkblot(GenericNavigableComic):
2945
    """Generic class to retrieve comics using WordPress with Inkblot."""
2946
    get_navi_link = get_link_rel_next
2947
2948
    @classmethod
2949
    def get_first_comic_link(cls):
2950
        """Get link to first comics."""
2951
        return get_soup_at_url(cls.url).find('a', class_='webcomic-link webcomic1-link first-webcomic-link first-webcomic1-link')
2952
2953
    @classmethod
2954
    def get_comic_info(cls, soup, link):
2955
        """Get information about a particular comics."""
2956
        title = soup.find('meta', property='og:title')['content']
2957
        imgs = soup.find('div', class_='webcomic-image').find_all('img')
2958
        date_str = soup.find('meta', property='article:published_time')['content'][:10]
2959
        day = string_to_date(date_str, "%Y-%m-%d")
2960
        return {
2961
            'title': title,
2962
            'day': day.day,