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
@@ 1810-1829 (lines=20) @@
1807
    get_first_comic_link = simulate_first_link
1808
    first_url = 'http://respawncomic.com/comic/c0001/'
1809
1810
    @classmethod
1811
    def get_comic_info(cls, soup, link):
1812
        """Get information about a particular comics."""
1813
        title = soup.find('meta', property='og:title')['content']
1814
        author = soup.find('meta', attrs={'name': 'shareaholic:article_author_name'})['content']
1815
        date_str = soup.find('meta', attrs={'name': 'shareaholic:article_published_time'})['content']
1816
        date_str = date_str[:10]
1817
        day = string_to_date(date_str, "%Y-%m-%d")
1818
        imgs = soup.find_all('meta', property='og:image')
1819
        skip_imgs = {
1820
            'http://respawncomic.com/wp-content/uploads/2016/03/site/HAROLD2.png',
1821
            'http://respawncomic.com/wp-content/uploads/2016/03/site/DEVA.png'
1822
        }
1823
        return {
1824
            'title': title,
1825
            'author': author,
1826
            'day': day.day,
1827
            'month': day.month,
1828
            'year': day.year,
1829
            'img': [i['content'] for i in imgs if i['content'] not in skip_imgs],
1830
        }
1831
1832