Code Duplication    Length = 21-23 lines in 5 locations

comics.py 5 locations

@@ 645-667 (lines=23) @@
642
        }
643
644
645
class OneOneOneOneComic(GenericNavigableComic):
646
    """Class to retrieve 1111 Comics."""
647
    # Also on http://comics1111.tumblr.com
648
    # Also on https://tapastic.com/series/1111-Comics
649
    name = '1111'
650
    long_name = '1111 Comics'
651
    url = 'http://www.1111comics.me'
652
    get_first_comic_link = get_div_navfirst_a
653
    get_navi_link = get_link_rel_next
654
655
    @classmethod
656
    def get_comic_info(cls, soup, link):
657
        """Get information about a particular comics."""
658
        title = soup.find('h1', class_='comic-title').find('a').string
659
        date_str = soup.find('header', class_='comic-meta entry-meta').find('a').string
660
        day = string_to_date(date_str, "%B %d, %Y")
661
        imgs = soup.find_all('meta', property='og:image')
662
        return {
663
            'title': title,
664
            'month': day.month,
665
            'year': day.year,
666
            'day': day.day,
667
            'img': [i['content'] for i in imgs],
668
        }
669
670
@@ 671-692 (lines=22) @@
668
        }
669
670
671
class AngryAtNothing(GenericNavigableComic):
672
    """Class to retrieve Angry at Nothing comics."""
673
    # Also on http://tapastic.com/series/Comics-yeah-definitely-comics-
674
    name = 'angry'
675
    long_name = 'Angry At Nothing'
676
    url = 'http://www.angryatnothing.net'
677
    get_first_comic_link = get_div_navfirst_a
678
    get_navi_link = get_a_rel_next
679
680
    @classmethod
681
    def get_comic_info(cls, soup, link):
682
        """Get information about a particular comics."""
683
        title = soup.find('h1', class_='comic-title').find('a').string
684
        date_str = soup.find('header', class_='comic-meta entry-meta').find('a').string
685
        day = string_to_date(date_str, "%B %d, %Y")
686
        imgs = soup.find_all('meta', property='og:image')
687
        return {
688
            'title': title,
689
            'month': day.month,
690
            'year': day.year,
691
            'day': day.day,
692
            'img': [i['content'] for i in imgs],
693
        }
694
695
@@ 620-641 (lines=22) @@
617
        }
618
619
620
class PenelopeBagieu(GenericNavigableComic):
621
    """Class to retrieve comics from Penelope Bagieu's blog."""
622
    name = 'bagieu'
623
    long_name = 'Ma vie est tout a fait fascinante (Bagieu)'
624
    url = 'http://www.penelope-jolicoeur.com'
625
    get_navi_link = get_link_rel_next
626
    get_first_comic_link = simulate_first_link
627
    first_url = 'http://www.penelope-jolicoeur.com/2007/02/ma-vie-mon-oeuv.html'
628
629
    @classmethod
630
    def get_comic_info(cls, soup, link):
631
        """Get information about a particular comics."""
632
        date_str = soup.find('h2', class_='date-header').string
633
        day = string_to_date(date_str, "%A %d %B %Y", "fr_FR.utf8")
634
        imgs = soup.find('div', class_='entry-body').find_all('img')
635
        title = soup.find('h3', class_='entry-header').string
636
        return {
637
            'title': title,
638
            'img': [i['src'] for i in imgs],
639
            'month': day.month,
640
            'year': day.year,
641
            'day': day.day,
642
        }
643
644
@@ 2576-2596 (lines=21) @@
2573
        }
2574
2575
2576
class PlanC(GenericNavigableComic):
2577
    """Class to retrieve Plan C comics."""
2578
    name = 'planc'
2579
    long_name = 'Plan C'
2580
    url = 'http://www.plancomic.com'
2581
    get_first_comic_link = get_a_navi_navifirst
2582
    get_navi_link = get_a_navi_comicnavnext_navinext
2583
2584
    @classmethod
2585
    def get_comic_info(cls, soup, link):
2586
        """Get information about a particular comics."""
2587
        title = soup.find('h2', class_='post-title').string
2588
        date_str = soup.find("span", class_="post-date").string
2589
        day = string_to_date(date_str, "%B %d, %Y")
2590
        imgs = soup.find('div', id='comic').find_all('img')
2591
        return {
2592
            'title': title,
2593
            'img': [i['src'] for i in imgs],
2594
            'month': day.month,
2595
            'year': day.year,
2596
            'day': day.day,
2597
        }
2598
2599
@@ 1650-1670 (lines=21) @@
1647
        }
1648
1649
1650
class WarehouseComic(GenericNavigableComic):
1651
    """Class to retrieve Warehouse Comic comics."""
1652
    name = 'warehouse'
1653
    long_name = 'Warehouse Comic'
1654
    url = 'http://warehousecomic.com'
1655
    get_first_comic_link = get_a_navi_navifirst
1656
    get_navi_link = get_link_rel_next
1657
1658
    @classmethod
1659
    def get_comic_info(cls, soup, link):
1660
        """Get information about a particular comics."""
1661
        title = soup.find('h2', class_='post-title').string
1662
        date_str = soup.find('span', class_='post-date').string
1663
        day = string_to_date(date_str, "%B %d, %Y")
1664
        imgs = soup.find('div', id='comic').find_all('img')
1665
        return {
1666
            'img': [i['src'] for i in imgs],
1667
            'title': title,
1668
            'day': day.day,
1669
            'month': day.month,
1670
            'year': day.year,
1671
        }
1672
1673