@@ 1433-1463 (lines=31) @@ | ||
1430 | @classmethod |
|
1431 | def get_comic_info(cls, soup, link): |
|
1432 | """Get information about a particular comics.""" |
|
1433 | date_str = soup.find('font', face='Arial,Helvetica,Geneva,Swiss,SunSans-Regular', color='white').string.strip() |
|
1434 | try: |
|
1435 | day = string_to_date(date_str, '%m/%d/%Y') |
|
1436 | except ValueError: |
|
1437 | print("Invalid date %s" % date_str) |
|
1438 | day = date.today() |
|
1439 | title = soup.find('meta', attrs={'name': 'twitter:title'})['content'] |
|
1440 | return { |
|
1441 | 'year': day.year, |
|
1442 | 'month': day.month, |
|
1443 | 'day': day.day, |
|
1444 | 'img': [soup.find('img', id='comic')['src']], |
|
1445 | 'title': title, |
|
1446 | } |
|
1447 | ||
1448 | ||
1449 | class Octopuns(GenericNavigableComic): |
|
1450 | """Class to retrieve Octopuns comics.""" |
|
1451 | # Also on http://octopuns.tumblr.com |
|
1452 | name = 'octopuns' |
|
1453 | long_name = 'Octopuns' |
|
1454 | url = 'http://www.octopuns.net' |
|
1455 | ||
1456 | @classmethod |
|
1457 | def get_first_comic_link(cls): |
|
1458 | """Get link to first comics.""" |
|
1459 | return get_soup_at_url(cls.url).find('img', src=re.compile('.*/First.png')).parent |
|
1460 | ||
1461 | @classmethod |
|
1462 | def get_navi_link(cls, last_soup, next_): |
|
1463 | """Get link to next or previous comic.""" |
|
1464 | link = last_soup.find('img', src=re.compile('.*/Next.png' if next_ else '.*/Back.png')).parent |
|
1465 | return None if link.get('href') is None else link |
|
1466 | ||
@@ 1987-2015 (lines=29) @@ | ||
1984 | name = 'poorlydrawn' |
|
1985 | long_name = 'Poorly Drawn Lines' |
|
1986 | url = 'http://poorlydrawnlines.com' |
|
1987 | _categories = ('POORLYDRAWN', ) |
|
1988 | get_url_from_archive_element = get_href |
|
1989 | ||
1990 | @classmethod |
|
1991 | def get_comic_info(cls, soup, link): |
|
1992 | """Get information about a particular comics.""" |
|
1993 | imgs = soup.find('div', class_='post').find_all('img') |
|
1994 | assert len(imgs) <= 1 |
|
1995 | return { |
|
1996 | 'img': [i['src'] for i in imgs], |
|
1997 | 'title': imgs[0].get('title', "") if imgs else "", |
|
1998 | } |
|
1999 | ||
2000 | @classmethod |
|
2001 | def get_archive_elements(cls): |
|
2002 | archive_url = urljoin_wrapper(cls.url, 'archive') |
|
2003 | url_re = re.compile('^%s/comic/.' % cls.url) |
|
2004 | return reversed(get_soup_at_url(archive_url).find_all('a', href=url_re)) |
|
2005 | ||
2006 | ||
2007 | class LoadingComics(GenericNavigableComic): |
|
2008 | """Class to retrieve Loading Artist comics.""" |
|
2009 | name = 'loadingartist' |
|
2010 | long_name = 'Loading Artist' |
|
2011 | url = 'http://www.loadingartist.com/latest' |
|
2012 | ||
2013 | @classmethod |
|
2014 | def get_first_comic_link(cls): |
|
2015 | """Get link to first comics.""" |
|
2016 | return get_soup_at_url(cls.url).find('a', title="First") |
|
2017 | ||
2018 | @classmethod |