Code Duplication    Length = 21-23 lines in 2 locations

comics.py 2 locations

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