Code Duplication    Length = 21-23 lines in 4 locations

comics.py 4 locations

@@ 658-680 (lines=23) @@
655
        }
656
657
658
class OneOneOneOneComic(GenericNavigableComic):
659
    """Class to retrieve 1111 Comics."""
660
    # Also on http://comics1111.tumblr.com
661
    # Also on https://tapastic.com/series/1111-Comics
662
    name = '1111'
663
    long_name = '1111 Comics'
664
    url = 'http://www.1111comics.me'
665
    get_first_comic_link = get_div_navfirst_a
666
    get_navi_link = get_link_rel_next
667
668
    @classmethod
669
    def get_comic_info(cls, soup, link):
670
        """Get information about a particular comics."""
671
        title = soup.find('h1', class_='comic-title').find('a').string
672
        date_str = soup.find('header', class_='comic-meta entry-meta').find('a').string
673
        day = string_to_date(date_str, "%B %d, %Y")
674
        imgs = soup.find_all('meta', property='og:image')
675
        return {
676
            'title': title,
677
            'month': day.month,
678
            'year': day.year,
679
            'day': day.day,
680
            'img': [i['content'] for i in imgs],
681
        }
682
683
@@ 633-654 (lines=22) @@
630
        }
631
632
633
class PenelopeBagieu(GenericNavigableComic):
634
    """Class to retrieve comics from Penelope Bagieu's blog."""
635
    name = 'bagieu'
636
    long_name = 'Ma vie est tout a fait fascinante (Bagieu)'
637
    url = 'http://www.penelope-jolicoeur.com'
638
    get_navi_link = get_link_rel_next
639
    get_first_comic_link = simulate_first_link
640
    first_url = 'http://www.penelope-jolicoeur.com/2007/02/ma-vie-mon-oeuv.html'
641
642
    @classmethod
643
    def get_comic_info(cls, soup, link):
644
        """Get information about a particular comics."""
645
        date_str = soup.find('h2', class_='date-header').string
646
        day = string_to_date(date_str, "%A %d %B %Y", "fr_FR.utf8")
647
        imgs = soup.find('div', class_='entry-body').find_all('img')
648
        title = soup.find('h3', class_='entry-header').string
649
        return {
650
            'title': title,
651
            'img': [i['src'] for i in imgs],
652
            'month': day.month,
653
            'year': day.year,
654
            'day': day.day,
655
        }
656
657
@@ 2574-2594 (lines=21) @@
2571
        }
2572
2573
2574
class PlanC(GenericNavigableComic):
2575
    """Class to retrieve Plan C comics."""
2576
    name = 'planc'
2577
    long_name = 'Plan C'
2578
    url = 'http://www.plancomic.com'
2579
    get_first_comic_link = get_a_navi_navifirst
2580
    get_navi_link = get_a_navi_comicnavnext_navinext
2581
2582
    @classmethod
2583
    def get_comic_info(cls, soup, link):
2584
        """Get information about a particular comics."""
2585
        title = soup.find('h2', class_='post-title').string
2586
        date_str = soup.find("span", class_="post-date").string
2587
        day = string_to_date(date_str, "%B %d, %Y")
2588
        imgs = soup.find('div', id='comic').find_all('img')
2589
        return {
2590
            'title': title,
2591
            'img': [i['src'] for i in imgs],
2592
            'month': day.month,
2593
            'year': day.year,
2594
            'day': day.day,
2595
        }
2596
2597
@@ 883-905 (lines=23) @@
880
        }
881
882
883
class TheGentlemanArmchair(GenericNavigableComic):
884
    """Class to retrieve The Gentleman Armchair comics."""
885
    name = 'gentlemanarmchair'
886
    long_name = 'The Gentleman Armchair'
887
    url = 'http://thegentlemansarmchair.com'
888
    get_first_comic_link = get_a_navi_navifirst
889
    get_navi_link = get_link_rel_next
890
891
    @classmethod
892
    def get_comic_info(cls, soup, link):
893
        """Get information about a particular comics."""
894
        title = soup.find('h2', class_='post-title').string
895
        author = soup.find("span", class_="post-author").find("a").string
896
        date_str = soup.find('span', class_='post-date').string
897
        day = string_to_date(date_str, "%B %d, %Y")
898
        imgs = soup.find('div', id='comic').find_all('img')
899
        return {
900
            'img': [i['src'] for i in imgs],
901
            'title': title,
902
            'author': author,
903
            'month': day.month,
904
            'year': day.year,
905
            'day': day.day,
906
        }
907
908