Code Duplication    Length = 30-31 lines in 2 locations

comics.py 2 locations

@@ 2737-2767 (lines=31) @@
2734
    url = 'http://comics.boumerie.com'
2735
    date_format = "%B %d, %Y"
2736
    lang = 'en_GB.UTF-8'
2737
2738
2739
class BoumerieFr(GenericBoumerie):
2740
    """Class to retrieve Boumeries comics in French."""
2741
    name = 'boumeries_fr'
2742
    long_name = 'Boumeries (Fr)'
2743
    url = 'http://bd.boumerie.com'
2744
    _categories = ('FRANCAIS', )
2745
    date_format = "%A, %d %B %Y"
2746
    lang = "fr_FR.utf8"
2747
2748
2749
class UnearthedComics(GenericNavigableComic):
2750
    """Class to retrieve Unearthed comics."""
2751
    # Also on http://tapastic.com/series/UnearthedComics
2752
    # Also on http://unearthedcomics.tumblr.com
2753
    name = 'unearthed'
2754
    long_name = 'Unearthed Comics'
2755
    url = 'http://unearthedcomics.com'
2756
    _categories = ('UNEARTHED', )
2757
    get_navi_link = get_link_rel_next
2758
    get_first_comic_link = simulate_first_link
2759
    first_url = 'http://unearthedcomics.com/comics/world-with-turn-signals/'
2760
2761
    @classmethod
2762
    def get_comic_info(cls, soup, link):
2763
        """Get information about a particular comics."""
2764
        short_url = soup.find('link', rel='shortlink')['href']
2765
        title_elt = soup.find('h1') or soup.find('h2')
2766
        title = title_elt.string if title_elt else ""
2767
        desc = soup.find('meta', property='og:description')
2768
        date_str = soup.find('time', class_='published updated hidden')['datetime']
2769
        day = string_to_date(date_str, "%Y-%m-%d")
2770
        post = soup.find('div', class_="entry content entry-content type-portfolio")
@@ 459-488 (lines=30) @@
456
    """Class to retrieve Les Culottees comics."""
457
    name = 'culottees'
458
    long_name = 'Les Culottees'
459
    url = "http://lesculottees.blog.lemonde.fr"
460
    first_url = "http://lesculottees.blog.lemonde.fr/2016/01/11/clementine-delait-femme-a-barbe/"
461
462
463
class UneAnneeAuLycee(GenericLeMondeBlog):
464
    """Class to retrieve Une Annee Au Lycee comics."""
465
    name = 'lycee'
466
    long_name = 'Une Annee au Lycee'
467
    url = 'http://uneanneeaulycee.blog.lemonde.fr'
468
    first_url = "http://uneanneeaulycee.blog.lemonde.fr/2016/06/13/la-semaine-du-bac-est-arrivee/"
469
470
471
class Rall(GenericNavigableComic):
472
    """Class to retrieve Ted Rall comics."""
473
    # Also on http://www.gocomics.com/tedrall
474
    name = 'rall'
475
    long_name = "Ted Rall"
476
    url = "http://rall.com/comic"
477
    _categories = ('RALL', )
478
    get_navi_link = get_link_rel_next
479
    get_first_comic_link = simulate_first_link
480
    # Not the first but I didn't find an efficient way to retrieve it
481
    first_url = "http://rall.com/2014/01/30/los-angeles-times-cartoon-well-miss-those-california-flowers"
482
483
    @classmethod
484
    def get_comic_info(cls, soup, link):
485
        """Get information about a particular comics."""
486
        title = soup.find('meta', property='og:title')['content']
487
        author = soup.find("span", class_="author vcard").find("a").string
488
        date_str = soup.find("span", class_="entry-date").string
489
        day = string_to_date(date_str, "%B %d, %Y")
490
        desc = soup.find('meta', property='og:description')['content']
491
        imgs = soup.find('div', class_='entry-content').find_all('img')