Code Duplication    Length = 16-17 lines in 2 locations

comics.py 2 locations

@@ 4666-4682 (lines=17) @@
4663
    long_name = 'Cowardly Comics (from Tumblr)'
4664
    url = 'http://cowardlycomics.tumblr.com'
4665
4666
4667
class Caw4hwTumblr(GenericTumblrV1):
4668
    """Class to retrieve Caw4hw comics."""
4669
    # Also on https://tapas.io/series/CAW4HW
4670
    name = 'caw4hw-tumblr'
4671
    long_name = 'Caw4hw (from Tumblr)'
4672
    url = 'https://caw4hw.tumblr.com'
4673
4674
4675
class HorovitzComics(GenericDeletedComic, GenericListableComic):
4676
    """Generic class to handle the logic common to the different comics from Horovitz."""
4677
    # Also on https://horovitzcomics.tumblr.com
4678
    url = 'http://www.horovitzcomics.com'
4679
    _categories = ('HOROVITZ', )
4680
    img_re = re.compile('.*comics/([0-9]*)/([0-9]*)/([0-9]*)/.*$')
4681
    link_re = NotImplemented
4682
    get_url_from_archive_element = join_cls_url_to_href
4683
4684
    @classmethod
4685
    def get_comic_info(cls, soup, link):
@@ 763-778 (lines=16) @@
760
    get_first_comic_link = get_div_navfirst_a
761
    get_navi_link = get_link_rel_next
762
    get_url_from_link = join_cls_url_to_href
763
764
    @classmethod
765
    def get_comic_info(cls, soup, link):
766
        """Get information about a particular comics."""
767
        short_url_re = re.compile('^%s/\\?p=([0-9]*)' % cls.url)
768
        short_url = cls.get_url_from_link(soup.find('link', rel='shortlink'))
769
        num = int(short_url_re.match(short_url).groups()[0])
770
        imgs = soup.find('div', id='comic').find_all('img')
771
        assert len(imgs) == 1
772
        title = imgs[0]['alt']
773
        title2 = imgs[0]['title']
774
        return {
775
            'short_url': short_url,
776
            'title': title,
777
            'title2': title2,
778
            'img': [urljoin_wrapper(cls.url, i['src']) for i in imgs],
779
            'num': num,
780
        }
781