Code Duplication    Length = 23-28 lines in 2 locations

comics.py 2 locations

@@ 2232-2259 (lines=28) @@
2229
            'title': title,
2230
            'alt': imgs[0].get('alt', ''),
2231
            'img': [i['src'] for i in imgs],
2232
            'month': day.month,
2233
            'year': day.year,
2234
            'day': day.day,
2235
        }
2236
2237
2238
class LonnieMillsap(GenericNavigableComic):
2239
    """Class to retrieve Lonnie Millsap's comics."""
2240
    name = 'millsap'
2241
    long_name = 'Lonnie Millsap'
2242
    url = 'http://www.lonniemillsap.com'
2243
    get_navi_link = get_link_rel_next
2244
2245
    @classmethod
2246
    def get_first_comic_link(cls):
2247
        """Get link to first comics."""
2248
        return {'href': 'http://www.lonniemillsap.com/?p=42'}
2249
2250
    @classmethod
2251
    def get_comic_info(cls, soup, link):
2252
        """Get information about a particular comics."""
2253
        title = soup.find('h2', class_='post-title').string
2254
        post = soup.find('div', class_='post-content')
2255
        author = post.find("span", class_="post-author").find("a").string
2256
        date_str = post.find("span", class_="post-date").string
2257
        day = string_to_date(date_str, "%B %d, %Y")
2258
        imgs = post.find("div", class_="entry").find_all("img")
2259
        return {
2260
            'title': title,
2261
            'author': author,
2262
            'img': [i['src'] for i in imgs],
@@ 882-904 (lines=23) @@
879
        }
880
881
882
class TheGentlemanArmchair(GenericNavigableComic):
883
    """Class to retrieve The Gentleman Armchair comics."""
884
    name = 'gentlemanarmchair'
885
    long_name = 'The Gentleman Armchair'
886
    url = 'http://thegentlemansarmchair.com'
887
    get_first_comic_link = get_a_navi_navifirst
888
    get_navi_link = get_link_rel_next
889
890
    @classmethod
891
    def get_comic_info(cls, soup, link):
892
        """Get information about a particular comics."""
893
        title = soup.find('h2', class_='post-title').string
894
        author = soup.find("span", class_="post-author").find("a").string
895
        date_str = soup.find('span', class_='post-date').string
896
        day = string_to_date(date_str, "%B %d, %Y")
897
        imgs = soup.find('div', id='comic').find_all('img')
898
        return {
899
            'img': [i['src'] for i in imgs],
900
            'title': title,
901
            'author': author,
902
            'month': day.month,
903
            'year': day.year,
904
            'day': day.day,
905
        }
906
907