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