Code Duplication    Length = 21-23 lines in 2 locations

comics.py 2 locations

@@ 645-667 (lines=23) @@
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
    _categories = ('FRANCAIS', )
649
    get_navi_link = get_link_rel_next
650
    get_first_comic_link = simulate_first_link
651
    first_url = 'http://www.penelope-jolicoeur.com/2007/02/ma-vie-mon-oeuv.html'
652
653
    @classmethod
654
    def get_comic_info(cls, soup, link):
655
        """Get information about a particular comics."""
656
        date_str = soup.find('h2', class_='date-header').string
657
        day = string_to_date(date_str, "%A %d %B %Y", "fr_FR.utf8")
658
        imgs = soup.find('div', class_='entry-body').find_all('img')
659
        title = soup.find('h3', class_='entry-header').string
660
        return {
661
            'title': title,
662
            'img': [i['src'] for i in imgs],
663
            'month': day.month,
664
            'year': day.year,
665
            'day': day.day,
666
        }
667
668
669
class OneOneOneOneComic(GenericNavigableComic):
670
    """Class to retrieve 1111 Comics."""
@@ 1650-1670 (lines=21) @@
1647
    """Class to retrieve the Wondermark comics."""
1648
    name = 'wondermark'
1649
    long_name = 'Wondermark'
1650
    url = 'http://wondermark.com'
1651
    get_url_from_archive_element = get_href
1652
1653
    @classmethod
1654
    def get_archive_elements(cls):
1655
        archive_url = urljoin_wrapper(cls.url, 'archive/')
1656
        return reversed(get_soup_at_url(archive_url).find_all('a', rel='bookmark'))
1657
1658
    @classmethod
1659
    def get_comic_info(cls, soup, link):
1660
        """Get information about a particular comics."""
1661
        date_str = soup.find('div', class_='postdate').find('em').string
1662
        day = string_to_date(remove_st_nd_rd_th_from_date(date_str), "%B %d, %Y")
1663
        div = soup.find('div', id='comic')
1664
        if div:
1665
            img = div.find('img')
1666
            img_src = [img['src']]
1667
            alt = img['alt']
1668
            assert alt == img['title']
1669
            title = soup.find('meta', property='og:title')['content']
1670
        else:
1671
            img_src = []
1672
            alt = ''
1673
            title = ''