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