Code Duplication    Length = 21-23 lines in 2 locations

comics.py 2 locations

@@ 645-667 (lines=23) @@
642
    def get_comic_info(cls, soup, link):
643
        """Get information about a particular comics."""
644
        date_str = soup.find('h2', class_='date-header').string
645
        day = string_to_date(date_str, "%A %d %B %Y", "fr_FR.utf8")
646
        imgs = soup.find('div', class_='entry-body').find_all('img')
647
        title = soup.find('h3', class_='entry-header').string
648
        return {
649
            'title': title,
650
            'img': [i['src'] for i in imgs],
651
            'month': day.month,
652
            'year': day.year,
653
            'day': day.day,
654
        }
655
656
657
class OneOneOneOneComic(GenericNavigableComic):
658
    """Class to retrieve 1111 Comics."""
659
    # Also on http://comics1111.tumblr.com
660
    # Also on https://tapastic.com/series/1111-Comics
661
    name = '1111'
662
    long_name = '1111 Comics'
663
    url = 'http://www.1111comics.me'
664
    _categories = ('ONEONEONEONE', )
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."""
@@ 1650-1670 (lines=21) @@
1647
    def get_comic_info(cls, soup, link):
1648
        """Get information about a particular comics."""
1649
        date_str = soup.find('div', class_='postdate').find('em').string
1650
        day = string_to_date(remove_st_nd_rd_th_from_date(date_str), "%B %d, %Y")
1651
        div = soup.find('div', id='comic')
1652
        if div:
1653
            img = div.find('img')
1654
            img_src = [img['src']]
1655
            alt = img['alt']
1656
            assert alt == img['title']
1657
            title = soup.find('meta', property='og:title')['content']
1658
        else:
1659
            img_src = []
1660
            alt = ''
1661
            title = ''
1662
        return {
1663
            'month': day.month,
1664
            'year': day.year,
1665
            'day': day.day,
1666
            'img': img_src,
1667
            'title': title,
1668
            'alt': alt,
1669
            'tags': ' '.join(t.string for t in soup.find('div', class_='postmeta').find_all('a', rel='tag')),
1670
        }
1671
1672
1673
class WarehouseComic(GenericNavigableComic):