Code Duplication    Length = 22-24 lines in 2 locations

comics.py 2 locations

@@ 1067-1088 (lines=22) @@
1064
        }
1065
1066
1067
class PerryBibleFellowship(GenericListableComic):  # Is now navigable too
1068
    """Class to retrieve Perry Bible Fellowship comics."""
1069
    name = 'pbf'
1070
    long_name = 'Perry Bible Fellowship'
1071
    url = 'http://pbfcomics.com'
1072
    get_url_from_archive_element = join_cls_url_to_href
1073
1074
    @classmethod
1075
    def get_archive_elements(cls):
1076
        soup = get_soup_at_url(cls.url)
1077
        thumbnails = soup.find('div', id='all_thumbnails')
1078
        return reversed(thumbnails.find_all('a'))
1079
1080
    @classmethod
1081
    def get_comic_info(cls, soup, link):
1082
        """Get information about a particular comics."""
1083
        name = soup.find('meta', property='og:title')['content']
1084
        imgs = soup.find_all('meta', property='og:image')
1085
        assert len(imgs) == 1, imgs
1086
        return {
1087
            'name': name,
1088
            'img': [i['content'] for i in imgs],
1089
        }
1090
1091
@@ 2079-2102 (lines=24) @@
2076
            'title': title,
2077
            'alt': alt,
2078
            'author': author,
2079
        }
2080
2081
2082
class PoorlyDrawnLines(GenericListableComic):
2083
    """Class to retrieve Poorly Drawn Lines comics."""
2084
    # Also on http://pdlcomics.tumblr.com
2085
    name = 'poorlydrawn'
2086
    long_name = 'Poorly Drawn Lines'
2087
    url = 'https://www.poorlydrawnlines.com'
2088
    _categories = ('POORLYDRAWN', )
2089
    get_url_from_archive_element = get_href
2090
2091
    @classmethod
2092
    def get_comic_info(cls, soup, link):
2093
        """Get information about a particular comics."""
2094
        imgs = soup.find('div', class_='post').find_all('img')
2095
        assert len(imgs) <= 1, imgs
2096
        return {
2097
            'img': [i['src'] for i in imgs],
2098
            'title': imgs[0].get('title', "") if imgs else "",
2099
        }
2100
2101
    @classmethod
2102
    def get_archive_elements(cls):
2103
        archive_url = urljoin_wrapper(cls.url, 'archive')
2104
        url_re = re.compile('^%s/comic/.' % cls.url)
2105
        return reversed(get_soup_at_url(archive_url).find_all('a', href=url_re))