Code Duplication    Length = 16-20 lines in 2 locations

comics.py 2 locations

@@ 1879-1898 (lines=20) @@
1876
    get_navi_link = get_a_rel_next
1877
    get_first_comic_link = simulate_first_link
1878
    first_url = 'http://respawncomic.com/comic/c0001/'
1879
1880
    @classmethod
1881
    def get_comic_info(cls, soup, link):
1882
        """Get information about a particular comics."""
1883
        title = soup.find('meta', property='og:title')['content']
1884
        author = soup.find('meta', attrs={'name': 'shareaholic:article_author_name'})['content']
1885
        date_str = soup.find('meta', attrs={'name': 'shareaholic:article_published_time'})['content']
1886
        date_str = date_str[:10]
1887
        day = string_to_date(date_str, "%Y-%m-%d")
1888
        imgs = soup.find_all('meta', property='og:image')
1889
        skip_imgs = {
1890
            'http://respawncomic.com/wp-content/uploads/2016/03/site/HAROLD2.png',
1891
            'http://respawncomic.com/wp-content/uploads/2016/03/site/DEVA.png'
1892
        }
1893
        return {
1894
            'title': title,
1895
            'author': author,
1896
            'day': day.day,
1897
            'month': day.month,
1898
            'year': day.year,
1899
            'img': [i['content'] for i in imgs if i['content'] not in skip_imgs],
1900
        }
1901
@@ 600-615 (lines=16) @@
597
        # prev is next / next is prev
598
        li = last_soup.find('li', class_='prev' if next_ else 'next')
599
        return li.find('a') if li else None
600
601
    @classmethod
602
    def get_comic_info(cls, soup, link):
603
        """Get information about a particular comics."""
604
        short_url = soup.find('link', rel='shortlink')['href']
605
        title = soup.find('meta', attrs={'name': 'twitter:title'})['content']
606
        imgs = soup.find_all('meta', property='og:image')
607
        date_str = soup.find('span', property='dc:date')['content']
608
        date_str = date_str[:10]
609
        day = string_to_date(date_str, "%Y-%m-%d")
610
        return {
611
            'short_url': short_url,
612
            'title': title,
613
            'img': [i['content'] for i in imgs],
614
            'day': day.day,
615
            'month': day.month,
616
            'year': day.year,
617
        }
618