Code Duplication    Length = 16-17 lines in 2 locations

comics.py 2 locations

@@ 4666-4682 (lines=17) @@
4663
class HorovitzNew(HorovitzComics):
4664
    """Class to retrieve Horovitz new comics."""
4665
    name = 'horovitznew'
4666
    long_name = 'Horovitz New'
4667
    link_re = re.compile('^/comics/new/([0-9]+)$')
4668
4669
4670
class HorovitzClassic(HorovitzComics):
4671
    """Class to retrieve Horovitz classic comics."""
4672
    name = 'horovitzclassic'
4673
    long_name = 'Horovitz Classic'
4674
    link_re = re.compile('^/comics/classic/([0-9]+)$')
4675
4676
4677
class GenericGoComic(GenericNavigableComic):
4678
    """Generic class to handle the logic common to comics from gocomics.com."""
4679
    _categories = ('GOCOMIC', )
4680
4681
    @classmethod
4682
    def get_first_comic_link(cls):
4683
        """Get link to first comics."""
4684
        return get_soup_at_url(cls.url).find('a', class_='fa btn btn-outline-default btn-circle fa-backward sm ')
4685
@@ 763-778 (lines=16) @@
760
    get_navi_link = get_link_rel_next
761
    get_url_from_link = join_cls_url_to_href
762
763
    @classmethod
764
    def get_comic_info(cls, soup, link):
765
        """Get information about a particular comics."""
766
        short_url_re = re.compile('^%s/\\?p=([0-9]*)' % cls.url)
767
        short_url = cls.get_url_from_link(soup.find('link', rel='shortlink'))
768
        num = int(short_url_re.match(short_url).groups()[0])
769
        imgs = soup.find('div', id='comic').find_all('img')
770
        assert len(imgs) == 1
771
        title = imgs[0]['alt']
772
        title2 = imgs[0]['title']
773
        return {
774
            'short_url': short_url,
775
            'title': title,
776
            'title2': title2,
777
            'img': [urljoin_wrapper(cls.url, i['src']) for i in imgs],
778
            'num': num,
779
        }
780
781