@@ 1437-1466 (lines=30) @@ | ||
1434 | @classmethod |
|
1435 | def get_first_comic_link(cls): |
|
1436 | """Get link to first comics.""" |
|
1437 | return get_soup_at_url(cls.url).find('img', src='images/first_button.gif').parent |
|
1438 | ||
1439 | @classmethod |
|
1440 | def get_navi_link(cls, last_soup, next_): |
|
1441 | img = last_soup.find('img', src='images/next_button.gif' if next_ else 'images/prev_button.gif') |
|
1442 | return None if img is None else img.parent |
|
1443 | ||
1444 | @classmethod |
|
1445 | def get_comic_info(cls, soup, link): |
|
1446 | """Get information about a particular comics.""" |
|
1447 | date_str = soup.find('font', face='Arial,Helvetica,Geneva,Swiss,SunSans-Regular', color='white').string.strip() |
|
1448 | try: |
|
1449 | day = string_to_date(date_str, '%m/%d/%Y') |
|
1450 | except ValueError: |
|
1451 | print("Invalid date %s" % date_str) |
|
1452 | day = date.today() |
|
1453 | title = soup.find('meta', attrs={'name': 'twitter:title'})['content'] |
|
1454 | return { |
|
1455 | 'year': day.year, |
|
1456 | 'month': day.month, |
|
1457 | 'day': day.day, |
|
1458 | 'img': [soup.find('img', id='comic')['src']], |
|
1459 | 'title': title, |
|
1460 | } |
|
1461 | ||
1462 | ||
1463 | class Octopuns(GenericNavigableComic): |
|
1464 | """Class to retrieve Octopuns comics.""" |
|
1465 | # Also on http://octopuns.tumblr.com |
|
1466 | name = 'octopuns' |
|
1467 | long_name = 'Octopuns' |
|
1468 | url = 'http://www.octopuns.net' |
|
1469 | ||
@@ 2003-2030 (lines=28) @@ | ||
2000 | 'author': author, |
|
2001 | } |
|
2002 | ||
2003 | ||
2004 | class PoorlyDrawnLines(GenericListableComic): |
|
2005 | """Class to retrieve Poorly Drawn Lines comics.""" |
|
2006 | # Also on http://pdlcomics.tumblr.com |
|
2007 | name = 'poorlydrawn' |
|
2008 | long_name = 'Poorly Drawn Lines' |
|
2009 | url = 'http://poorlydrawnlines.com' |
|
2010 | get_url_from_archive_element = get_href |
|
2011 | ||
2012 | @classmethod |
|
2013 | def get_comic_info(cls, soup, link): |
|
2014 | """Get information about a particular comics.""" |
|
2015 | imgs = soup.find('div', class_='post').find_all('img') |
|
2016 | assert len(imgs) <= 1 |
|
2017 | return { |
|
2018 | 'img': [i['src'] for i in imgs], |
|
2019 | 'title': imgs[0].get('title', "") if imgs else "", |
|
2020 | } |
|
2021 | ||
2022 | @classmethod |
|
2023 | def get_archive_elements(cls): |
|
2024 | archive_url = urljoin_wrapper(cls.url, 'archive') |
|
2025 | url_re = re.compile('^%s/comic/.' % cls.url) |
|
2026 | return reversed(get_soup_at_url(archive_url).find_all('a', href=url_re)) |
|
2027 | ||
2028 | ||
2029 | class LoadingComics(GenericNavigableComic): |
|
2030 | """Class to retrieve Loading Artist comics.""" |
|
2031 | name = 'loadingartist' |
|
2032 | long_name = 'Loading Artist' |
|
2033 | url = 'http://www.loadingartist.com/latest' |