@@ 1431-1461 (lines=31) @@ | ||
1428 | } |
|
1429 | ||
1430 | ||
1431 | class Octopuns(GenericNavigableComic): |
|
1432 | """Class to retrieve Octopuns comics.""" |
|
1433 | # Also on http://octopuns.tumblr.com |
|
1434 | name = 'octopuns' |
|
1435 | long_name = 'Octopuns' |
|
1436 | url = 'http://www.octopuns.net' |
|
1437 | ||
1438 | @classmethod |
|
1439 | def get_first_comic_link(cls): |
|
1440 | """Get link to first comics.""" |
|
1441 | return get_soup_at_url(cls.url).find('img', src=re.compile('.*/First.png')).parent |
|
1442 | ||
1443 | @classmethod |
|
1444 | def get_navi_link(cls, last_soup, next_): |
|
1445 | """Get link to next or previous comic.""" |
|
1446 | link = last_soup.find('img', src=re.compile('.*/Next.png' if next_ else '.*/Back.png')).parent |
|
1447 | return None if link.get('href') is None else link |
|
1448 | ||
1449 | @classmethod |
|
1450 | def get_comic_info(cls, soup, link): |
|
1451 | """Get information about a particular comics.""" |
|
1452 | title = soup.find('h3', class_='post-title entry-title').string |
|
1453 | date_str = soup.find('h2', class_='date-header').string |
|
1454 | day = string_to_date(date_str, "%A, %B %d, %Y") |
|
1455 | imgs = soup.find_all('link', rel='image_src') |
|
1456 | return { |
|
1457 | 'img': [i['href'] for i in imgs], |
|
1458 | 'title': title, |
|
1459 | 'day': day.day, |
|
1460 | 'month': day.month, |
|
1461 | 'year': day.year, |
|
1462 | } |
|
1463 | ||
1464 | ||
@@ 1985-2013 (lines=29) @@ | ||
1982 | return reversed(get_soup_at_url(archive_url).find_all('a', href=url_re)) |
|
1983 | ||
1984 | ||
1985 | class LoadingComics(GenericNavigableComic): |
|
1986 | """Class to retrieve Loading Artist comics.""" |
|
1987 | name = 'loadingartist' |
|
1988 | long_name = 'Loading Artist' |
|
1989 | url = 'http://www.loadingartist.com/latest' |
|
1990 | ||
1991 | @classmethod |
|
1992 | def get_first_comic_link(cls): |
|
1993 | """Get link to first comics.""" |
|
1994 | return get_soup_at_url(cls.url).find('a', title="First") |
|
1995 | ||
1996 | @classmethod |
|
1997 | def get_navi_link(cls, last_soup, next_): |
|
1998 | """Get link to next or previous comic.""" |
|
1999 | return last_soup.find('a', title='Next' if next_ else 'Previous') |
|
2000 | ||
2001 | @classmethod |
|
2002 | def get_comic_info(cls, soup, link): |
|
2003 | """Get information about a particular comics.""" |
|
2004 | title = soup.find('h1').string |
|
2005 | date_str = soup.find('span', class_='date').string.strip() |
|
2006 | day = string_to_date(date_str, "%B %d, %Y") |
|
2007 | imgs = soup.find('div', class_='comic').find_all('img', alt='', title='') |
|
2008 | return { |
|
2009 | 'title': title, |
|
2010 | 'img': [i['src'] for i in imgs], |
|
2011 | 'month': day.month, |
|
2012 | 'year': day.year, |
|
2013 | 'day': day.day, |
|
2014 | } |
|
2015 | ||
2016 |