Code Duplication    Length = 19-20 lines in 2 locations

comics.py 2 locations

@@ 2223-2242 (lines=20) @@
2220
    name = 'fatawesome'
2221
    long_name = 'Fat Awesome'
2222
    url = 'http://fatawesome.com/comics'
2223
    get_navi_link = get_a_rel_next
2224
    get_first_comic_link = simulate_first_link
2225
    first_url = 'http://fatawesome.com/shortbus/'
2226
2227
    @classmethod
2228
    def get_comic_info(cls, soup, link):
2229
        """Get information about a particular comics."""
2230
        title = soup.find('meta', attrs={'name': 'twitter:title'})['content']
2231
        description = soup.find('meta', attrs={'name': 'description'})['content']
2232
        tags_prop = soup.find('meta', property='article:tag')
2233
        tags = tags_prop['content'] if tags_prop else ""
2234
        date_str = soup.find('meta', property='article:published_time')['content'][:10]
2235
        day = string_to_date(date_str, "%Y-%m-%d")
2236
        imgs = soup.find_all('img', attrs={'data-recalc-dims': "1"})
2237
        assert len(imgs) == 1
2238
        return {
2239
            'title': title,
2240
            'description': description,
2241
            'tags': tags,
2242
            'alt': "".join(i['alt'] for i in imgs),
2243
            'img': [i['src'].rsplit('?', 1)[0] for i in imgs],
2244
            'month': day.month,
2245
            'year': day.year,
@@ 1914-1932 (lines=19) @@
1911
        img = soup.find('img', src=comic_img_re)
1912
        comic_url = cls.get_url_from_link(link)
1913
        return {
1914
            'title': soup.find('h2', id='titleheader').string,
1915
            'title2': soup.find('div', id='subtext').string,
1916
            'alt': img.get('title'),
1917
            'img': [urljoin_wrapper(comic_url, img['src'].strip())],
1918
            'num': int(comic_url.split('/')[-1]),
1919
        }
1920
1921
1922
class InvisibleBread(GenericListableComic):
1923
    """Class to retrieve Invisible Bread comics."""
1924
    # Also on http://www.gocomics.com/invisible-bread
1925
    name = 'invisiblebread'
1926
    long_name = 'Invisible Bread'
1927
    url = 'http://invisiblebread.com'
1928
1929
    @classmethod
1930
    def get_archive_elements(cls):
1931
        archive_url = urljoin_wrapper(cls.url, 'archives/')
1932
        return reversed(get_soup_at_url(archive_url).find_all('td', class_='archive-title'))
1933
1934
    @classmethod
1935
    def get_url_from_archive_element(cls, td):