Code Duplication    Length = 16-20 lines in 2 locations

comics.py 2 locations

@@ 1834-1853 (lines=20) @@
1831
    get_first_comic_link = simulate_first_link
1832
    first_url = 'http://respawncomic.com/comic/c0001/'
1833
1834
    @classmethod
1835
    def get_comic_info(cls, soup, link):
1836
        """Get information about a particular comics."""
1837
        title = soup.find('meta', property='og:title')['content']
1838
        author = soup.find('meta', attrs={'name': 'shareaholic:article_author_name'})['content']
1839
        date_str = soup.find('meta', attrs={'name': 'shareaholic:article_published_time'})['content']
1840
        date_str = date_str[:10]
1841
        day = string_to_date(date_str, "%Y-%m-%d")
1842
        imgs = soup.find_all('meta', property='og:image')
1843
        skip_imgs = {
1844
            'http://respawncomic.com/wp-content/uploads/2016/03/site/HAROLD2.png',
1845
            'http://respawncomic.com/wp-content/uploads/2016/03/site/DEVA.png'
1846
        }
1847
        return {
1848
            'title': title,
1849
            'author': author,
1850
            'day': day.day,
1851
            'month': day.month,
1852
            'year': day.year,
1853
            'img': [i['content'] for i in imgs if i['content'] not in skip_imgs],
1854
        }
1855
1856
@@ 555-570 (lines=16) @@
552
        li = last_soup.find('li', class_='prev' if next_ else 'next')
553
        return li.find('a') if li else None
554
555
    @classmethod
556
    def get_comic_info(cls, soup, link):
557
        """Get information about a particular comics."""
558
        short_url = soup.find('link', rel='shortlink')['href']
559
        title = soup.find('meta', attrs={'name': 'twitter:title'})['content']
560
        imgs = soup.find_all('meta', property='og:image')
561
        date_str = soup.find('span', property='dc:date')['content']
562
        date_str = date_str[:10]
563
        day = string_to_date(date_str, "%Y-%m-%d")
564
        return {
565
            'short_url': short_url,
566
            'title': title,
567
            'img': [i['content'] for i in imgs],
568
            'day': day.day,
569
            'month': day.month,
570
            'year': day.year,
571
        }
572
573