@@ 1459-1489 (lines=31) @@ | ||
1456 | } |
|
1457 | ||
1458 | ||
1459 | class Octopuns(GenericEmptyComic, GenericNavigableComic): |
|
1460 | """Class to retrieve Octopuns comics.""" |
|
1461 | # Also on http://octopuns.tumblr.com |
|
1462 | name = 'octopuns' |
|
1463 | long_name = 'Octopuns' |
|
1464 | url = 'http://www.octopuns.net' |
|
1465 | ||
1466 | @classmethod |
|
1467 | def get_first_comic_link(cls): |
|
1468 | """Get link to first comics.""" |
|
1469 | return get_soup_at_url(cls.url).find('img', src=re.compile('.*/First.png')).parent |
|
1470 | ||
1471 | @classmethod |
|
1472 | def get_navi_link(cls, last_soup, next_): |
|
1473 | """Get link to next or previous comic.""" |
|
1474 | link = last_soup.find('img', src=re.compile('.*/Next.png' if next_ else '.*/Back.png')).parent |
|
1475 | return None if link.get('href') is None else link |
|
1476 | ||
1477 | @classmethod |
|
1478 | def get_comic_info(cls, soup, link): |
|
1479 | """Get information about a particular comics.""" |
|
1480 | title = soup.find('h3', class_='post-title entry-title').string |
|
1481 | date_str = soup.find('h2', class_='date-header').string |
|
1482 | day = string_to_date(date_str, "%A, %B %d, %Y") |
|
1483 | imgs = soup.find_all('link', rel='image_src') |
|
1484 | return { |
|
1485 | 'img': [i['href'] for i in imgs], |
|
1486 | 'title': title, |
|
1487 | 'day': day.day, |
|
1488 | 'month': day.month, |
|
1489 | 'year': day.year, |
|
1490 | } |
|
1491 | ||
1492 | ||
@@ 2017-2045 (lines=29) @@ | ||
2014 | return reversed(get_soup_at_url(archive_url).find_all('a', href=url_re)) |
|
2015 | ||
2016 | ||
2017 | class LoadingComics(GenericNavigableComic): |
|
2018 | """Class to retrieve Loading Artist comics.""" |
|
2019 | name = 'loadingartist' |
|
2020 | long_name = 'Loading Artist' |
|
2021 | url = 'http://www.loadingartist.com/latest' |
|
2022 | ||
2023 | @classmethod |
|
2024 | def get_first_comic_link(cls): |
|
2025 | """Get link to first comics.""" |
|
2026 | return get_soup_at_url(cls.url).find('a', title="First") |
|
2027 | ||
2028 | @classmethod |
|
2029 | def get_navi_link(cls, last_soup, next_): |
|
2030 | """Get link to next or previous comic.""" |
|
2031 | return last_soup.find('a', title='Next' if next_ else 'Previous') |
|
2032 | ||
2033 | @classmethod |
|
2034 | def get_comic_info(cls, soup, link): |
|
2035 | """Get information about a particular comics.""" |
|
2036 | title = soup.find('h1').string |
|
2037 | date_str = soup.find('span', class_='date').string.strip() |
|
2038 | day = string_to_date(date_str, "%B %d, %Y") |
|
2039 | imgs = soup.find('div', class_='comic').find_all('img', alt='', title='') |
|
2040 | return { |
|
2041 | 'title': title, |
|
2042 | 'img': [i['src'] for i in imgs], |
|
2043 | 'month': day.month, |
|
2044 | 'year': day.year, |
|
2045 | 'day': day.day, |
|
2046 | } |
|
2047 | ||
2048 |