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