Code Duplication    Length = 22-24 lines in 2 locations

comics.py 2 locations

@@ 2106-2129 (lines=24) @@
2103
        }
2104
2105
2106
class PoorlyDrawnLines(GenericListableComic):
2107
    """Class to retrieve Poorly Drawn Lines comics."""
2108
    # Also on http://pdlcomics.tumblr.com
2109
    name = 'poorlydrawn'
2110
    long_name = 'Poorly Drawn Lines'
2111
    url = 'https://www.poorlydrawnlines.com'
2112
    _categories = ('POORLYDRAWN', )
2113
    get_url_from_archive_element = get_href
2114
2115
    @classmethod
2116
    def get_comic_info(cls, soup, link):
2117
        """Get information about a particular comics."""
2118
        imgs = soup.find('div', class_='post').find_all('img')
2119
        assert len(imgs) <= 1, imgs
2120
        return {
2121
            'img': [i['src'] for i in imgs],
2122
            'title': imgs[0].get('title', "") if imgs else "",
2123
        }
2124
2125
    @classmethod
2126
    def get_archive_elements(cls):
2127
        archive_url = urljoin_wrapper(cls.url, 'archive')
2128
        url_re = re.compile('^%s/comic/.' % cls.url)
2129
        return reversed(get_soup_at_url(archive_url).find_all('a', href=url_re))
2130
2131
2132
class LoadingComics(GenericNavigableComic):
@@ 1093-1114 (lines=22) @@
1090
        }
1091
1092
1093
class PerryBibleFellowship(GenericListableComic):  # Is now navigable too
1094
    """Class to retrieve Perry Bible Fellowship comics."""
1095
    name = 'pbf'
1096
    long_name = 'Perry Bible Fellowship'
1097
    url = 'http://pbfcomics.com'
1098
    get_url_from_archive_element = join_cls_url_to_href
1099
1100
    @classmethod
1101
    def get_archive_elements(cls):
1102
        soup = get_soup_at_url(cls.url)
1103
        thumbnails = soup.find('div', id='all_thumbnails')
1104
        return reversed(thumbnails.find_all('a'))
1105
1106
    @classmethod
1107
    def get_comic_info(cls, soup, link):
1108
        """Get information about a particular comics."""
1109
        name = soup.find('meta', property='og:title')['content']
1110
        imgs = soup.find_all('meta', property='og:image')
1111
        assert len(imgs) == 1, imgs
1112
        return {
1113
            'name': name,
1114
            'img': [i['content'] for i in imgs],
1115
        }
1116
1117