Code Duplication    Length = 28-30 lines in 2 locations

comics.py 2 locations

@@ 1746-1775 (lines=30) @@
1743
        }
1744
1745
1746
class RespawnComic(GenericNavigableComic):
1747
    """Class to retrieve Respawn Comic."""
1748
    # Also on http://respawncomic.tumblr.com
1749
    name = 'respawn'
1750
    long_name = 'Respawn Comic'
1751
    url = 'http://respawncomic.com '
1752
    get_navi_link = get_a_navi_comicnavnext_navinext
1753
    get_first_comic_link = simulate_first_link
1754
    first_url = 'http://respawncomic.com/comic/c0001/'
1755
1756
    @classmethod
1757
    def get_comic_info(cls, soup, link):
1758
        """Get information about a particular comics."""
1759
        title = soup.find('meta', property='og:title')['content']
1760
        author = soup.find('meta', attrs={'name': 'shareaholic:article_author_name'})['content']
1761
        date_str = soup.find('meta', attrs={'name': 'shareaholic:article_published_time'})['content']
1762
        date_str = date_str[:10]
1763
        day = string_to_date(date_str, "%Y-%m-%d")
1764
        imgs = soup.find_all('meta', property='og:image')
1765
        skip_imgs = {
1766
            'http://respawncomic.com/wp-content/uploads/2016/03/site/HAROLD2.png',
1767
            'http://respawncomic.com/wp-content/uploads/2016/03/site/DEVA.png'
1768
        }
1769
        return {
1770
            'title': title,
1771
            'author': author,
1772
            'day': day.day,
1773
            'month': day.month,
1774
            'year': day.year,
1775
            'img': [i['content'] for i in imgs if i['content'] not in skip_imgs],
1776
        }
1777
1778
@@ 992-1019 (lines=28) @@
989
        }
990
991
992
class Mercworks(GenericNavigableComic):
993
    """Class to retrieve Mercworks comics."""
994
    # Also on http://mercworks.tumblr.com
995
    name = 'mercworks'
996
    long_name = 'Mercworks'
997
    url = 'http://mercworks.net'
998
    get_first_comic_link = get_a_comicnavbase_comicnavfirst
999
    get_navi_link = get_a_rel_next
1000
1001
    @classmethod
1002
    def get_comic_info(cls, soup, link):
1003
        """Get information about a particular comics."""
1004
        title = soup.find('meta', property='og:title')['content']
1005
        metadesc = soup.find('meta', property='og:description')
1006
        desc = metadesc['content'] if metadesc else ""
1007
        author = soup.find('meta', attrs={'name': 'shareaholic:article_author_name'})['content']
1008
        date_str = soup.find('meta', attrs={'name': 'shareaholic:article_published_time'})['content']
1009
        date_str = date_str[:10]
1010
        day = string_to_date(date_str, "%Y-%m-%d")
1011
        imgs = soup.find_all('meta', property='og:image')
1012
        return {
1013
            'img': [i['content'] for i in imgs],
1014
            'title': title,
1015
            'author': author,
1016
            'desc': desc,
1017
            'day': day.day,
1018
            'month': day.month,
1019
            'year': day.year
1020
        }
1021
1022