Code Duplication    Length = 30-31 lines in 2 locations

comics.py 2 locations

@@ 471-500 (lines=30) @@
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')
492
        imgs = imgs[:-7]  # remove social media buttons
493
        return {
494
            'title': title,
495
            'author': author,
496
            'month': day.month,
497
            'year': day.year,
498
            'day': day.day,
499
            'description': desc,
500
            'img': [i['src'] for i in imgs],
501
        }
502
503
@@ 2740-2770 (lines=31) @@
2737
            'month': day.month,
2738
            'year': day.year,
2739
            'day': day.day,
2740
        }
2741
2742
2743
class BoumerieEn(GenericBoumerie):
2744
    """Class to retrieve Boumeries comics in English."""
2745
    name = 'boumeries_en'
2746
    long_name = 'Boumeries (En)'
2747
    url = 'http://comics.boumerie.com'
2748
    date_format = "%B %d, %Y"
2749
    lang = 'en_GB.UTF-8'
2750
2751
2752
class BoumerieFr(GenericBoumerie):
2753
    """Class to retrieve Boumeries comics in French."""
2754
    name = 'boumeries_fr'
2755
    long_name = 'Boumeries (Fr)'
2756
    url = 'http://bd.boumerie.com'
2757
    _categories = ('FRANCAIS', )
2758
    date_format = "%A, %d %B %Y"
2759
    lang = "fr_FR.utf8"
2760
2761
2762
class UnearthedComics(GenericNavigableComic):
2763
    """Class to retrieve Unearthed comics."""
2764
    # Also on http://tapastic.com/series/UnearthedComics
2765
    # Also on http://unearthedcomics.tumblr.com
2766
    name = 'unearthed'
2767
    long_name = 'Unearthed Comics'
2768
    url = 'http://unearthedcomics.com'
2769
    _categories = ('UNEARTHED', )
2770
    get_navi_link = get_link_rel_next
2771
    get_first_comic_link = simulate_first_link
2772
    first_url = 'http://unearthedcomics.com/comics/world-with-turn-signals/'
2773