Code Duplication    Length = 30-31 lines in 2 locations

comics.py 2 locations

@@ 3628-3658 (lines=31) @@
3625
            'day': day.day,
3626
            'month': day.month,
3627
            'year': day.year,
3628
            'img': [urljoin_wrapper(cls.url, i['src']) for i in imgs],
3629
        }
3630
3631
3632
class GloryOwlComix(GenericBlogspotComic):
3633
    """Class to retrieve Glory Owl comics."""
3634
    name = 'gloryowl'
3635
    long_name = 'Glory Owl'
3636
    url = 'http://gloryowlcomix.blogspot.fr'
3637
    _categories = ('NSFW', 'FRANCAIS')
3638
    first_url = 'http://gloryowlcomix.blogspot.fr/2013/02/1_7.html'
3639
3640
    @classmethod
3641
    def get_comic_info(cls, soup, link):
3642
        """Get information about a particular comics."""
3643
        title = soup.find('title').string
3644
        imgs = soup.find_all('link', rel='image_src')
3645
        author = soup.find('a', rel='author').string
3646
        return {
3647
            'img': [i['href'] for i in imgs],
3648
            'author': author,
3649
            'title': title,
3650
        }
3651
3652
3653
class AtRandomComics(GenericNavigableComic):
3654
    """Class to retrieve At Random Comics."""
3655
    name = 'atrandom'
3656
    long_name = 'At Random Comics'
3657
    url = 'http://www.atrandomcomics.com'
3658
    get_url_from_link = join_cls_url_to_href
3659
    get_first_comic_link = simulate_first_link
3660
    first_url = 'http://www.atrandomcomics.com/at-random-comics-home/2015/5/5/can-of-worms'
3661
@@ 1653-1682 (lines=30) @@
1650
    url = 'http://www.somethingofthatilk.com'
1651
1652
1653
class MonkeyUser(GenericNavigableComic):
1654
    """Class to retrieve Monkey User comics."""
1655
    name = 'monkeyuser'
1656
    long_name = 'Monkey User'
1657
    url = 'http://www.monkeyuser.com'
1658
    get_first_comic_link = simulate_first_link
1659
    first_url = 'http://www.monkeyuser.com/2016/project-lifecycle/'
1660
    get_url_from_link = join_cls_url_to_href
1661
1662
    @classmethod
1663
    def get_navi_link(cls, last_soup, next_):
1664
        """Get link to next or previous comic."""
1665
        div = last_soup.find('div', title='next' if next_ else 'previous')
1666
        return None if div is None else div.find('a')
1667
1668
    @classmethod
1669
    def get_comic_info(cls, soup, link):
1670
        """Get information about a particular comics."""
1671
        title = soup.find('meta', property='og:title')['content']
1672
        desc = soup.find('meta', property='og:description')['content']
1673
        imgs = soup.find_all('meta', property='og:image')
1674
        date_str = soup.find('span', class_='post-date').find('time').string
1675
        day = string_to_date(date_str, "%d %b %Y")
1676
        return {
1677
            'month': day.month,
1678
            'year': day.year,
1679
            'day': day.day,
1680
            'img': [i['content'] for i in imgs],
1681
            'title': title,
1682
            'description': desc,
1683
        }
1684
1685