Code Duplication    Length = 16-20 lines in 2 locations

comics.py 2 locations

@@ 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
@@ 1784-1803 (lines=20) @@
1781
    get_first_comic_link = simulate_first_link
1782
    first_url = 'http://respawncomic.com/comic/c0001/'
1783
1784
    @classmethod
1785
    def get_comic_info(cls, soup, link):
1786
        """Get information about a particular comics."""
1787
        title = soup.find('meta', property='og:title')['content']
1788
        author = soup.find('meta', attrs={'name': 'shareaholic:article_author_name'})['content']
1789
        date_str = soup.find('meta', attrs={'name': 'shareaholic:article_published_time'})['content']
1790
        date_str = date_str[:10]
1791
        day = string_to_date(date_str, "%Y-%m-%d")
1792
        imgs = soup.find_all('meta', property='og:image')
1793
        skip_imgs = {
1794
            'http://respawncomic.com/wp-content/uploads/2016/03/site/HAROLD2.png',
1795
            'http://respawncomic.com/wp-content/uploads/2016/03/site/DEVA.png'
1796
        }
1797
        return {
1798
            'title': title,
1799
            'author': author,
1800
            'day': day.day,
1801
            'month': day.month,
1802
            'year': day.year,
1803
            'img': [i['content'] for i in imgs if i['content'] not in skip_imgs],
1804
        }
1805
1806