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
@@ 993-1020 (lines=28) @@
990
        }
991
992
993
class Mercworks(GenericNavigableComic):
994
    """Class to retrieve Mercworks comics."""
995
    # Also on http://mercworks.tumblr.com
996
    name = 'mercworks'
997
    long_name = 'Mercworks'
998
    url = 'http://mercworks.net'
999
    get_first_comic_link = get_a_comicnavbase_comicnavfirst
1000
    get_navi_link = get_a_rel_next
1001
1002
    @classmethod
1003
    def get_comic_info(cls, soup, link):
1004
        """Get information about a particular comics."""
1005
        title = soup.find('meta', property='og:title')['content']
1006
        metadesc = soup.find('meta', property='og:description')
1007
        desc = metadesc['content'] if metadesc else ""
1008
        author = soup.find('meta', attrs={'name': 'shareaholic:article_author_name'})['content']
1009
        date_str = soup.find('meta', attrs={'name': 'shareaholic:article_published_time'})['content']
1010
        date_str = date_str[:10]
1011
        day = string_to_date(date_str, "%Y-%m-%d")
1012
        imgs = soup.find_all('meta', property='og:image')
1013
        return {
1014
            'img': [i['content'] for i in imgs],
1015
            'title': title,
1016
            'author': author,
1017
            'desc': desc,
1018
            'day': day.day,
1019
            'month': day.month,
1020
            'year': day.year
1021
        }
1022
1023