Code Duplication    Length = 21-23 lines in 5 locations

comics.py 5 locations

@@ 668-690 (lines=23) @@
665
        }
666
667
668
class OneOneOneOneComic(GenericNavigableComic):
669
    """Class to retrieve 1111 Comics."""
670
    # Also on http://comics1111.tumblr.com
671
    # Also on https://tapastic.com/series/1111-Comics
672
    name = '1111'
673
    long_name = '1111 Comics'
674
    url = 'http://www.1111comics.me'
675
    get_first_comic_link = get_div_navfirst_a
676
    get_navi_link = get_link_rel_next
677
678
    @classmethod
679
    def get_comic_info(cls, soup, link):
680
        """Get information about a particular comics."""
681
        title = soup.find('h1', class_='comic-title').find('a').string
682
        date_str = soup.find('header', class_='comic-meta entry-meta').find('a').string
683
        day = string_to_date(date_str, "%B %d, %Y")
684
        imgs = soup.find_all('meta', property='og:image')
685
        return {
686
            'title': title,
687
            'month': day.month,
688
            'year': day.year,
689
            'day': day.day,
690
            'img': [i['content'] for i in imgs],
691
        }
692
693
@@ 694-715 (lines=22) @@
691
        }
692
693
694
class AngryAtNothing(GenericNavigableComic):
695
    """Class to retrieve Angry at Nothing comics."""
696
    # Also on http://tapastic.com/series/Comics-yeah-definitely-comics-
697
    name = 'angry'
698
    long_name = 'Angry At Nothing'
699
    url = 'http://www.angryatnothing.net'
700
    get_first_comic_link = get_div_navfirst_a
701
    get_navi_link = get_a_rel_next
702
703
    @classmethod
704
    def get_comic_info(cls, soup, link):
705
        """Get information about a particular comics."""
706
        title = soup.find('h1', class_='comic-title').find('a').string
707
        date_str = soup.find('header', class_='comic-meta entry-meta').find('a').string
708
        day = string_to_date(date_str, "%B %d, %Y")
709
        imgs = soup.find_all('meta', property='og:image')
710
        return {
711
            'title': title,
712
            'month': day.month,
713
            'year': day.year,
714
            'day': day.day,
715
            'img': [i['content'] for i in imgs],
716
        }
717
718
@@ 643-664 (lines=22) @@
640
        }
641
642
643
class PenelopeBagieu(GenericNavigableComic):
644
    """Class to retrieve comics from Penelope Bagieu's blog."""
645
    name = 'bagieu'
646
    long_name = 'Ma vie est tout a fait fascinante (Bagieu)'
647
    url = 'http://www.penelope-jolicoeur.com'
648
    get_navi_link = get_link_rel_next
649
    get_first_comic_link = simulate_first_link
650
    first_url = 'http://www.penelope-jolicoeur.com/2007/02/ma-vie-mon-oeuv.html'
651
652
    @classmethod
653
    def get_comic_info(cls, soup, link):
654
        """Get information about a particular comics."""
655
        date_str = soup.find('h2', class_='date-header').string
656
        day = string_to_date(date_str, "%A %d %B %Y", "fr_FR.utf8")
657
        imgs = soup.find('div', class_='entry-body').find_all('img')
658
        title = soup.find('h3', class_='entry-header').string
659
        return {
660
            'title': title,
661
            'img': [i['src'] for i in imgs],
662
            'month': day.month,
663
            'year': day.year,
664
            'day': day.day,
665
        }
666
667
@@ 2600-2620 (lines=21) @@
2597
        }
2598
2599
2600
class PlanC(GenericNavigableComic):
2601
    """Class to retrieve Plan C comics."""
2602
    name = 'planc'
2603
    long_name = 'Plan C'
2604
    url = 'http://www.plancomic.com'
2605
    get_first_comic_link = get_a_navi_navifirst
2606
    get_navi_link = get_a_navi_comicnavnext_navinext
2607
2608
    @classmethod
2609
    def get_comic_info(cls, soup, link):
2610
        """Get information about a particular comics."""
2611
        title = soup.find('h2', class_='post-title').string
2612
        date_str = soup.find("span", class_="post-date").string
2613
        day = string_to_date(date_str, "%B %d, %Y")
2614
        imgs = soup.find('div', id='comic').find_all('img')
2615
        return {
2616
            'title': title,
2617
            'img': [i['src'] for i in imgs],
2618
            'month': day.month,
2619
            'year': day.year,
2620
            'day': day.day,
2621
        }
2622
2623
@@ 1674-1694 (lines=21) @@
1671
        }
1672
1673
1674
class WarehouseComic(GenericNavigableComic):
1675
    """Class to retrieve Warehouse Comic comics."""
1676
    name = 'warehouse'
1677
    long_name = 'Warehouse Comic'
1678
    url = 'http://warehousecomic.com'
1679
    get_first_comic_link = get_a_navi_navifirst
1680
    get_navi_link = get_link_rel_next
1681
1682
    @classmethod
1683
    def get_comic_info(cls, soup, link):
1684
        """Get information about a particular comics."""
1685
        title = soup.find('h2', class_='post-title').string
1686
        date_str = soup.find('span', class_='post-date').string
1687
        day = string_to_date(date_str, "%B %d, %Y")
1688
        imgs = soup.find('div', id='comic').find_all('img')
1689
        return {
1690
            'img': [i['src'] for i in imgs],
1691
            'title': title,
1692
            'day': day.day,
1693
            'month': day.month,
1694
            'year': day.year,
1695
        }
1696
1697