Code Duplication    Length = 16-20 lines in 3 locations

comics.py 3 locations

@@ 1011-1029 (lines=19) @@
1008
    @classmethod
1009
    def get_comic_info(cls, soup, link):
1010
        """Get information about a particular comics."""
1011
        url = cls.get_url_from_archive_element(link)
1012
        comic_img_re = re.compile('^/archive_b/PBF.*')
1013
        name = link.string
1014
        num = int(link['name'])
1015
        href = link['href']
1016
        assert href == '/%d/' % num
1017
        imgs = soup.find_all('img', src=comic_img_re)
1018
        assert len(imgs) == 1
1019
        assert imgs[0]['alt'] == name
1020
        return {
1021
            'num': num,
1022
            'name': name,
1023
            'img': [urljoin_wrapper(url, i['src']) for i in imgs],
1024
            'prefix': '%d-' % num,
1025
        }
1026
1027
1028
class Mercworks(GenericNavigableComic):
1029
    """Class to retrieve Mercworks comics."""
1030
    # Also on http://mercworks.tumblr.com
1031
    name = 'mercworks'
1032
    long_name = 'Mercworks'
@@ 498-513 (lines=16) @@
495
        return {
496
            'title': title,
497
            'author': author,
498
            'month': day.month,
499
            'year': day.year,
500
            'day': day.day,
501
            'description': desc,
502
            'img': [i['src'] for i in imgs],
503
        }
504
505
506
class Dilem(GenericNavigableComic):
507
    """Class to retrieve Ali Dilem comics."""
508
    name = 'dilem'
509
    long_name = 'Ali Dilem'
510
    url = 'http://information.tv5monde.com/dilem'
511
    get_url_from_link = join_cls_url_to_href
512
513
    @classmethod
514
    def get_first_comic_link(cls):
515
        """Get link to first comics."""
516
        return {'href': "http://information.tv5monde.com/dilem/2004-06-26"}
@@ 1769-1788 (lines=20) @@
1766
    url = 'http://bigfootjustice.com'
1767
    get_first_comic_link = get_a_navi_navifirst
1768
    get_navi_link = get_a_navi_comicnavnext_navinext
1769
1770
    @classmethod
1771
    def get_comic_info(cls, soup, link):
1772
        """Get information about a particular comics."""
1773
        imgs = soup.find('div', id='comic').find_all('img')
1774
        assert all(i['title'] == i['alt'] for i in imgs)
1775
        title = ' '.join(i['title'] for i in imgs)
1776
        return {
1777
            'img': [i['src'] for i in imgs],
1778
            'title': title,
1779
        }
1780
1781
1782
class RespawnComic(GenericNavigableComic):
1783
    """Class to retrieve Respawn Comic."""
1784
    # Also on http://respawncomic.tumblr.com
1785
    name = 'respawn'
1786
    long_name = 'Respawn Comic'
1787
    url = 'http://respawncomic.com '
1788
    get_navi_link = get_a_navi_comicnavnext_navinext
1789
1790
    @classmethod
1791
    def get_first_comic_link(cls):