Code Duplication    Length = 19-20 lines in 2 locations

comics.py 2 locations

@@ 2223-2242 (lines=20) @@
2220
            'title': title,
2221
            'description': description,
2222
            'tags': tags,
2223
            'alt': "".join(i['alt'] for i in imgs),
2224
            'img': [i['src'].rsplit('?', 1)[0] for i in imgs],
2225
            'month': day.month,
2226
            'year': day.year,
2227
            'day': day.day,
2228
        }
2229
2230
2231
class AnythingComic(GenericListableComic):
2232
    """Class to retrieve Anything Comics."""
2233
    # Also on http://tapastic.com/series/anything
2234
    name = 'anythingcomic'
2235
    long_name = 'Anything Comic'
2236
    url = 'http://www.anythingcomic.com'
2237
2238
    @classmethod
2239
    def get_archive_elements(cls):
2240
        archive_url = urljoin_wrapper(cls.url, 'archive/')
2241
        # The first 2 <tr>'s do not correspond to comics
2242
        return get_soup_at_url(archive_url).find('table', id='chapter_table').find_all('tr')[2:]
2243
2244
    @classmethod
2245
    def get_url_from_archive_element(cls, tr):
@@ 1914-1932 (lines=19) @@
1911
    @classmethod
1912
    def get_comic_info(cls, soup, link):
1913
        """Get information about a particular comics."""
1914
        comic_img_re = re.compile('^dhdcomics/.*')
1915
        img = soup.find('img', src=comic_img_re)
1916
        comic_url = cls.get_url_from_link(link)
1917
        return {
1918
            'title': soup.find('h2', id='titleheader').string,
1919
            'title2': soup.find('div', id='subtext').string,
1920
            'alt': img.get('title'),
1921
            'img': [urljoin_wrapper(comic_url, img['src'].strip())],
1922
            'num': int(comic_url.split('/')[-1]),
1923
        }
1924
1925
1926
class InvisibleBread(GenericListableComic):
1927
    """Class to retrieve Invisible Bread comics."""
1928
    # Also on http://www.gocomics.com/invisible-bread
1929
    name = 'invisiblebread'
1930
    long_name = 'Invisible Bread'
1931
    url = 'http://invisiblebread.com'
1932
1933
    @classmethod
1934
    def get_archive_elements(cls):
1935
        archive_url = urljoin_wrapper(cls.url, 'archives/')