Code Duplication    Length = 13-20 lines in 3 locations

comics.py 3 locations

@@ 526-541 (lines=16) @@
523
        li = last_soup.find('li', class_='prev' if next_ else 'next')
524
        return li.find('a') if li else None
525
526
    @classmethod
527
    def get_comic_info(cls, soup, link):
528
        """Get information about a particular comics."""
529
        short_url = soup.find('link', rel='shortlink')['href']
530
        title = soup.find('meta', attrs={'name': 'twitter:title'})['content']
531
        imgs = soup.find_all('meta', property='og:image')
532
        date_str = soup.find('span', property='dc:date')['content']
533
        date_str = date_str[:10]
534
        day = string_to_date(date_str, "%Y-%m-%d")
535
        return {
536
            'short_url': short_url,
537
            'title': title,
538
            'img': [i['content'] for i in imgs],
539
            'day': day.day,
540
            'month': day.month,
541
            'year': day.year,
542
        }
543
544
@@ 1807-1826 (lines=20) @@
1804
    get_first_comic_link = simulate_first_link
1805
    first_url = 'http://respawncomic.com/comic/c0001/'
1806
1807
    @classmethod
1808
    def get_comic_info(cls, soup, link):
1809
        """Get information about a particular comics."""
1810
        title = soup.find('meta', property='og:title')['content']
1811
        author = soup.find('meta', attrs={'name': 'shareaholic:article_author_name'})['content']
1812
        date_str = soup.find('meta', attrs={'name': 'shareaholic:article_published_time'})['content']
1813
        date_str = date_str[:10]
1814
        day = string_to_date(date_str, "%Y-%m-%d")
1815
        imgs = soup.find_all('meta', property='og:image')
1816
        skip_imgs = {
1817
            'http://respawncomic.com/wp-content/uploads/2016/03/site/HAROLD2.png',
1818
            'http://respawncomic.com/wp-content/uploads/2016/03/site/DEVA.png'
1819
        }
1820
        return {
1821
            'title': title,
1822
            'author': author,
1823
            'day': day.day,
1824
            'month': day.month,
1825
            'year': day.year,
1826
            'img': [i['content'] for i in imgs if i['content'] not in skip_imgs],
1827
        }
1828
1829
@@ 3079-3091 (lines=13) @@
3076
        """Get link to first comics."""
3077
        return get_soup_at_url(cls.url).find('a', class_='webcomic-link webcomic1-link first-webcomic-link first-webcomic1-link')
3078
3079
    @classmethod
3080
    def get_comic_info(cls, soup, link):
3081
        """Get information about a particular comics."""
3082
        title = soup.find('meta', property='og:title')['content']
3083
        imgs = soup.find('div', class_='webcomic-image').find_all('img')
3084
        date_str = soup.find('meta', property='article:published_time')['content'][:10]
3085
        day = string_to_date(date_str, "%Y-%m-%d")
3086
        return {
3087
            'title': title,
3088
            'day': day.day,
3089
            'month': day.month,
3090
            'year': day.year,
3091
            'img': [i['src'] for i in imgs],
3092
        }
3093
3094