Code Duplication    Length = 16-20 lines in 2 locations

comics.py 2 locations

@@ 521-536 (lines=16) @@
518
        """Get link to next or previous comic."""
519
        # prev is next / next is prev
520
        li = last_soup.find('li', class_='prev' if next_ else 'next')
521
        return li.find('a') if li else None
522
523
    @classmethod
524
    def get_comic_info(cls, soup, link):
525
        """Get information about a particular comics."""
526
        short_url = soup.find('link', rel='shortlink')['href']
527
        title = soup.find('meta', attrs={'name': 'twitter:title'})['content']
528
        imgs = soup.find_all('meta', property='og:image')
529
        date_str = soup.find('span', property='dc:date')['content']
530
        date_str = date_str[:10]
531
        day = string_to_date(date_str, "%Y-%m-%d")
532
        return {
533
            'short_url': short_url,
534
            'title': title,
535
            'img': [i['content'] for i in imgs],
536
            'day': day.day,
537
            'month': day.month,
538
            'year': day.year,
539
        }
@@ 1810-1829 (lines=20) @@
1807
    _categories = ('RESPAWN', )
1808
    get_navi_link = get_a_rel_next
1809
    get_first_comic_link = simulate_first_link
1810
    first_url = 'http://respawncomic.com/comic/c0001/'
1811
1812
    @classmethod
1813
    def get_comic_info(cls, soup, link):
1814
        """Get information about a particular comics."""
1815
        title = soup.find('meta', property='og:title')['content']
1816
        author = soup.find('meta', attrs={'name': 'shareaholic:article_author_name'})['content']
1817
        date_str = soup.find('meta', attrs={'name': 'shareaholic:article_published_time'})['content']
1818
        date_str = date_str[:10]
1819
        day = string_to_date(date_str, "%Y-%m-%d")
1820
        imgs = soup.find_all('meta', property='og:image')
1821
        skip_imgs = {
1822
            'http://respawncomic.com/wp-content/uploads/2016/03/site/HAROLD2.png',
1823
            'http://respawncomic.com/wp-content/uploads/2016/03/site/DEVA.png'
1824
        }
1825
        return {
1826
            'title': title,
1827
            'author': author,
1828
            'day': day.day,
1829
            'month': day.month,
1830
            'year': day.year,
1831
            'img': [i['content'] for i in imgs if i['content'] not in skip_imgs],
1832
        }