Code Duplication    Length = 16-20 lines in 2 locations

comics.py 2 locations

@@ 1789-1808 (lines=20) @@
1786
    get_first_comic_link = simulate_first_link
1787
    first_url = 'http://respawncomic.com/comic/c0001/'
1788
1789
    @classmethod
1790
    def get_comic_info(cls, soup, link):
1791
        """Get information about a particular comics."""
1792
        title = soup.find('meta', property='og:title')['content']
1793
        author = soup.find('meta', attrs={'name': 'shareaholic:article_author_name'})['content']
1794
        date_str = soup.find('meta', attrs={'name': 'shareaholic:article_published_time'})['content']
1795
        date_str = date_str[:10]
1796
        day = string_to_date(date_str, "%Y-%m-%d")
1797
        imgs = soup.find_all('meta', property='og:image')
1798
        skip_imgs = {
1799
            'http://respawncomic.com/wp-content/uploads/2016/03/site/HAROLD2.png',
1800
            'http://respawncomic.com/wp-content/uploads/2016/03/site/DEVA.png'
1801
        }
1802
        return {
1803
            'title': title,
1804
            'author': author,
1805
            'day': day.day,
1806
            'month': day.month,
1807
            'year': day.year,
1808
            'img': [i['content'] for i in imgs if i['content'] not in skip_imgs],
1809
        }
1810
1811
@@ 521-536 (lines=16) @@
518
        li = last_soup.find('li', class_='prev' if next_ else 'next')
519
        return li.find('a') if li else None
520
521
    @classmethod
522
    def get_comic_info(cls, soup, link):
523
        """Get information about a particular comics."""
524
        short_url = soup.find('link', rel='shortlink')['href']
525
        title = soup.find('meta', attrs={'name': 'twitter:title'})['content']
526
        imgs = soup.find_all('meta', property='og:image')
527
        date_str = soup.find('span', property='dc:date')['content']
528
        date_str = date_str[:10]
529
        day = string_to_date(date_str, "%Y-%m-%d")
530
        return {
531
            'short_url': short_url,
532
            'title': title,
533
            'img': [i['content'] for i in imgs],
534
            'day': day.day,
535
            'month': day.month,
536
            'year': day.year,
537
        }
538
539