Code Duplication    Length = 22-24 lines in 2 locations

comics.py 2 locations

@@ 2083-2106 (lines=24) @@
2080
        }
2081
2082
2083
class PoorlyDrawnLines(GenericListableComic):
2084
    """Class to retrieve Poorly Drawn Lines comics."""
2085
    # Also on http://pdlcomics.tumblr.com
2086
    name = 'poorlydrawn'
2087
    long_name = 'Poorly Drawn Lines'
2088
    url = 'https://www.poorlydrawnlines.com'
2089
    _categories = ('POORLYDRAWN', )
2090
    get_url_from_archive_element = get_href
2091
2092
    @classmethod
2093
    def get_comic_info(cls, soup, link):
2094
        """Get information about a particular comics."""
2095
        imgs = soup.find('div', class_='post').find_all('img')
2096
        assert len(imgs) <= 1, imgs
2097
        return {
2098
            'img': [i['src'] for i in imgs],
2099
            'title': imgs[0].get('title', "") if imgs else "",
2100
        }
2101
2102
    @classmethod
2103
    def get_archive_elements(cls):
2104
        archive_url = urljoin_wrapper(cls.url, 'archive')
2105
        url_re = re.compile('^%s/comic/.' % cls.url)
2106
        return reversed(get_soup_at_url(archive_url).find_all('a', href=url_re))
2107
2108
2109
class LoadingComics(GenericNavigableComic):
@@ 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