Code Duplication    Length = 14-16 lines in 2 locations

comics.py 2 locations

@@ 5406-5421 (lines=16) @@
5403
class GenericTapasticComic(GenericListableComic):
5404
    """Generic class to handle the logic common to comics from tapastic.com."""
5405
    _categories = ('TAPASTIC', )
5406
5407
    @classmethod
5408
    def get_comic_info(cls, soup, archive_elt):
5409
        """Get information about a particular comics."""
5410
        timestamp = int(archive_elt['publishDate']) / 1000.0
5411
        day = datetime.datetime.fromtimestamp(timestamp).date()
5412
        imgs = soup.find_all('img', class_='art-image')
5413
        if not imgs:
5414
            # print("Comic %s is being uploaded, retry later" % cls.get_url_from_archive_element(archive_elt))
5415
            return None
5416
        assert len(imgs) > 0, imgs
5417
        return {
5418
            'day': day.day,
5419
            'year': day.year,
5420
            'month': day.month,
5421
            'img': [i['src'] for i in imgs],
5422
            'title': archive_elt['title'],
5423
        }
5424
@@ 1042-1055 (lines=14) @@
1039
    def get_first_comic_link(cls):
1040
        """Get link to first comics."""
1041
        return get_soup_at_url(cls.url).find('a', class_='comic_nav_link first_comic_link')
1042
1043
    @classmethod
1044
    def get_comic_info(cls, soup, link):
1045
        """Get information about a particular comics."""
1046
        title = soup.find("h1", class_="comic_title").string
1047
        date_str = soup.find("span", class_="comic_date").string
1048
        day = string_to_date(date_str, "%B %d, %Y")
1049
        imgs = soup.find_all("img", class_="comic")
1050
        assert all(i['alt'] == i['title'] == title for i in imgs)
1051
        return {
1052
            'title': title,
1053
            'img': [i['src'] for i in imgs if i["src"]],
1054
            'day': day.day,
1055
            'month': day.month,
1056
            'year': day.year
1057
        }
1058