Code Duplication    Length = 18-18 lines in 2 locations

comics.py 2 locations

@@ 3607-3624 (lines=18) @@
3604
3605
    @classmethod
3606
    def get_comic_info(cls, soup, link):
3607
        """Get information about a particular comics."""
3608
        title = soup.find('meta', property='og:title')['content']
3609
        desc = soup.find('meta', property='og:description')
3610
        desc_str = "" if desc is None else desc['content']
3611
        date_str = soup.find('time', class_='published')['datetime']
3612
        day = string_to_date(date_str, "%Y-%m-%d")
3613
        author = soup.find('a', rel='author').string
3614
        div_content = (soup.find('div', class_="body entry-content") or
3615
                       soup.find('div', class_="special-content"))
3616
        imgs = div_content.find_all('img')
3617
        imgs = [i for i in imgs if i.get('src') is not None]
3618
        assert all('title' not in i or i['alt'] == i['title'] for i in imgs)
3619
        alt = imgs[0].get('alt', "") if imgs else []
3620
        return {
3621
            'title': title,
3622
            'alt': alt,
3623
            'description': desc_str,
3624
            'author': author,
3625
            'day': day.day,
3626
            'month': day.month,
3627
            'year': day.year,
@@ 3521-3538 (lines=18) @@
3518
    @classmethod
3519
    def get_comic_info(cls, soup, link):
3520
        """Get information about a particular comics."""
3521
        title = soup.find('meta', property='og:title')['content']
3522
        date_str = soup.find('time')["datetime"]
3523
        day = string_to_date(date_str, "%Y-%m-%d")
3524
        imgs = soup.find_all('meta', property='og:image')
3525
        return {
3526
            'title': title,
3527
            'img': [i['content'] for i in imgs],
3528
            'day': day.day,
3529
            'month': day.month,
3530
            'year': day.year,
3531
        }
3532
3533
3534
class GenericBlogspotComic(GenericNavigableComic):
3535
    """Generic class to retrieve comics from Blogspot."""
3536
    get_first_comic_link = simulate_first_link
3537
    first_url = NotImplemented
3538
    _categories = ('BLOGSPOT', )
3539
3540
    @classmethod
3541
    def get_navi_link(cls, last_soup, next_):