Skip to content

Commit

Permalink
Readding support for Octopuns - Closes #20
Browse files Browse the repository at this point in the history
  • Loading branch information
SylvainDe committed Feb 7, 2016
1 parent 073730f commit 5e39c80
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion comics.py
Original file line number Diff line number Diff line change
Expand Up @@ -1261,13 +1261,35 @@ def get_comic_info(cls, soup, link):
}


class Octopuns(GenericEmptyComic): # Does not exist anymore
class Octopuns(GenericNavigableComic):
"""Class to retrieve Octopuns comics."""
# Also on http://octopuns.tumblr.com/
name = 'octopuns'
long_name = 'Octopuns'
url = 'http://www.octopuns.net'

def get_first_comic_link(cls):
return get_soup_at_url(cls.url).find('img', src=re.compile('.*/First.png')).parent

@classmethod
def get_navi_link(cls, last_soup, next_):
link = last_soup.find('img', src=re.compile('.*/Next.png' if next_ else '.*/Back.png')).parent
return None if link.get('href') is None else link

@classmethod
def get_comic_info(cls, soup, link):
title = soup.find('h3', class_='post-title entry-title').string
date_str = soup.find('h2', class_='date-header').string
day = string_to_date(date_str, "%A, %B %d, %Y")
imgs = soup.find_all('link', rel='image_src')
return {
'img': [i['href'] for i in imgs],
'title': title,
'day': day.day,
'month': day.month,
'year': day.year,
}


class Quarktees(GenericNavigableComic):
"""Class to retrieve the Quarktees comics."""
Expand Down

0 comments on commit 5e39c80

Please sign in to comment.