Code Duplication    Length = 28-30 lines in 2 locations

comics.py 2 locations

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