Code Duplication    Length = 21-23 lines in 5 locations

comics.py 5 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
@@ 684-705 (lines=22) @@
681
        }
682
683
684
class AngryAtNothing(GenericNavigableComic):
685
    """Class to retrieve Angry at Nothing comics."""
686
    # Also on http://tapastic.com/series/Comics-yeah-definitely-comics-
687
    name = 'angry'
688
    long_name = 'Angry At Nothing'
689
    url = 'http://www.angryatnothing.net'
690
    get_first_comic_link = get_div_navfirst_a
691
    get_navi_link = get_a_rel_next
692
693
    @classmethod
694
    def get_comic_info(cls, soup, link):
695
        """Get information about a particular comics."""
696
        title = soup.find('h1', class_='comic-title').find('a').string
697
        date_str = soup.find('header', class_='comic-meta entry-meta').find('a').string
698
        day = string_to_date(date_str, "%B %d, %Y")
699
        imgs = soup.find_all('meta', property='og:image')
700
        return {
701
            'title': title,
702
            'month': day.month,
703
            'year': day.year,
704
            'day': day.day,
705
            'img': [i['content'] for i in imgs],
706
        }
707
708
@@ 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
@@ 1652-1672 (lines=21) @@
1649
        }
1650
1651
1652
class WarehouseComic(GenericNavigableComic):
1653
    """Class to retrieve Warehouse Comic comics."""
1654
    name = 'warehouse'
1655
    long_name = 'Warehouse Comic'
1656
    url = 'http://warehousecomic.com'
1657
    get_first_comic_link = get_a_navi_navifirst
1658
    get_navi_link = get_link_rel_next
1659
1660
    @classmethod
1661
    def get_comic_info(cls, soup, link):
1662
        """Get information about a particular comics."""
1663
        title = soup.find('h2', class_='post-title').string
1664
        date_str = soup.find('span', class_='post-date').string
1665
        day = string_to_date(date_str, "%B %d, %Y")
1666
        imgs = soup.find('div', id='comic').find_all('img')
1667
        return {
1668
            'img': [i['src'] for i in imgs],
1669
            'title': title,
1670
            'day': day.day,
1671
            'month': day.month,
1672
            'year': day.year,
1673
        }
1674
1675