Code Duplication    Length = 22-25 lines in 2 locations

comics.py 2 locations

@@ 2373-2397 (lines=25) @@
2370
        }
2371
2372
2373
class JuliasDrawings(GenericListableComic):
2374
    """Class to retrieve Julia's Drawings."""
2375
    name = 'julia'
2376
    long_name = "Julia's Drawings"
2377
    url = 'https://drawings.jvns.ca'
2378
    get_url_from_archive_element = get_href
2379
2380
    @classmethod
2381
    def get_archive_elements(cls):
2382
        articles = get_soup_at_url(cls.url).find_all('article', class_='li post')
2383
        return [art.find('a') for art in reversed(articles)]
2384
2385
    @classmethod
2386
    def get_comic_info(cls, soup, archive_elt):
2387
        """Get information about a particular comics."""
2388
        date_str = soup.find('meta', property='og:article:published_time')['content'][:10]
2389
        day = string_to_date(date_str, "%Y-%m-%d")
2390
        title = soup.find('h3', class_='p-post-title').string
2391
        imgs = soup.find('section', class_='post-content').find_all('img')
2392
        return {
2393
            'title': title,
2394
            'img': [urljoin_wrapper(cls.url, i['src']) for i in imgs],
2395
            'month': day.month,
2396
            'year': day.year,
2397
            'day': day.day,
2398
        }
2399
2400
@@ 434-455 (lines=22) @@
431
        }
432
433
434
class GenericLeMondeBlog(GenericNavigableComic):
435
    """Generic class to retrieve comics from Le Monde blogs."""
436
    _categories = ('LEMONDE', 'FRANCAIS')
437
    get_navi_link = get_link_rel_next
438
    get_first_comic_link = simulate_first_link
439
    first_url = NotImplemented
440
441
    @classmethod
442
    def get_comic_info(cls, soup, link):
443
        """Get information about a particular comics."""
444
        url2 = soup.find('link', rel='shortlink')['href']
445
        title = soup.find('meta', property='og:title')['content']
446
        date_str = soup.find("span", class_="entry-date").string
447
        day = string_to_date(date_str, "%d %B %Y", "fr_FR.utf8")
448
        imgs = soup.find_all('meta', property='og:image')
449
        return {
450
            'title': title,
451
            'url2': url2,
452
            'img': [convert_iri_to_plain_ascii_uri(i['content']) for i in imgs],
453
            'month': day.month,
454
            'year': day.year,
455
            'day': day.day,
456
        }
457
458